]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chanlog.cpp
Maxpara on these was 3, should be 2
[user/henk/code/inspircd.git] / src / modules / m_chanlog.cpp
index bb5adf67c32f2e34253cdbd6cda1b1419ccba0c9..9528a94de65a4d637be932ad6473b7da16b29c34 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
 
 /* $ModDesc: Logs snomask output to channel(s). */
 
-/*
- * This is for the "old" chanlog module which intercepted messages going to the logfile..
- * I don't consider it all that useful, and it's quite dangerous if setup incorrectly, so
- * this is defined out but left intact in case someone wants to develop it further someday.
- *
- * -- w00t (aug 23rd, 2008)
- */
-#define OLD_CHANLOG 0
-
-#if OLD_CHANLOG
-class ChannelLogStream : public LogStream
-{
- private:
-       std::string channel;
-
- public:
-       ChannelLogStream(InspIRCd *Instance, int loglevel, const std::string &chan) : LogStream(Instance, loglevel), channel(chan)
-       {
-       }
-
-       virtual void OnLog(int loglevel, const std::string &type, const std::string &msg)
-       {
-               Channel *c = ServerInstance->FindChan(channel);
-               static bool Logging = false;
-
-               if (loglevel < this->loglvl)
-                       return;
-
-               if (Logging)
-                       return;
-
-               if (c)
-               {
-                       Logging = true; // this avoids (rare chance) loops with logging server IO on networks
-                       char buf[MAXBUF];
-                       snprintf(buf, MAXBUF, "\2%s\2: %s", type.c_str(), msg.c_str());
-
-                       c->WriteChannelWithServ(ServerInstance->Config->ServerName, "PRIVMSG %s :%s", c->name.c_str(), buf);
-                       ServerInstance->PI->SendChannelPrivmsg(c, 0, buf);
-                       Logging = false;
-               }
-       }
-};
-#endif
-
 class ModuleChanLog : public Module
 {
  private:
@@ -100,11 +55,10 @@ class ModuleChanLog : public Module
                                continue;
                        }
 
-                       for (std::string::const_iterator it = snomasks.begin(); it != snomasks.end(); i++)
+                       for (std::string::const_iterator it = snomasks.begin(); it != snomasks.end(); it++)
                        {
                                logstreams.insert(std::make_pair(*it, channel));
                                ServerInstance->Logs->Log("m_chanlog", DEFAULT, "Logging %c to %s", *it, channel.c_str());
-                               it++;
                        }
                }
 
@@ -143,10 +97,63 @@ class ModuleChanLog : public Module
 
        virtual Version GetVersion()
        {
-               return Version(1,2,0,1,VF_VENDOR,API_VERSION);
+               return Version("$Id$", VF_VENDOR,API_VERSION);
        }
 };
 
 
 MODULE_INIT(ModuleChanLog)
 
+
+
+
+
+
+
+
+
+/*
+ * This is for the "old" chanlog module which intercepted messages going to the logfile..
+ * I don't consider it all that useful, and it's quite dangerous if setup incorrectly, so
+ * this is defined out but left intact in case someone wants to develop it further someday.
+ *
+ * -- w00t (aug 23rd, 2008)
+ */
+#define OLD_CHANLOG 0
+
+#if OLD_CHANLOG
+class ChannelLogStream : public LogStream
+{
+ private:
+       std::string channel;
+
+ public:
+       ChannelLogStream(InspIRCd *Instance, int loglevel, const std::string &chan) : LogStream(Instance, loglevel), channel(chan)
+       {
+       }
+
+       virtual void OnLog(int loglevel, const std::string &type, const std::string &msg)
+       {
+               Channel *c = ServerInstance->FindChan(channel);
+               static bool Logging = false;
+
+               if (loglevel < this->loglvl)
+                       return;
+
+               if (Logging)
+                       return;
+
+               if (c)
+               {
+                       Logging = true; // this avoids (rare chance) loops with logging server IO on networks
+                       char buf[MAXBUF];
+                       snprintf(buf, MAXBUF, "\2%s\2: %s", type.c_str(), msg.c_str());
+
+                       c->WriteChannelWithServ(ServerInstance->Config->ServerName, "PRIVMSG %s :%s", c->name.c_str(), buf);
+                       ServerInstance->PI->SendChannelPrivmsg(c, 0, buf);
+                       Logging = false;
+               }
+       }
+};
+#endif
+