]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Modify chanlog to send message remotely, too. Logging now works server <-> server...
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 4 Apr 2008 14:45:25 +0000 (14:45 +0000)
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 4 Apr 2008 14:45:25 +0000 (14:45 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9310 e03df62e-2008-0410-955e-edbf42e46eb7

src/modules/m_chanlog.cpp

index 56b9ec689e953ad4080ac2527e1d6dd552767a41..eb2fe8118863a312e64cb3ff1e042474f6e9ee24 100644 (file)
@@ -31,8 +31,11 @@ class ChannelLogStream : public LogStream
 
                if (c)
                {
-                       // So this won't work remotely. Oh well.
-                       c->WriteChannelWithServ(ServerInstance->Config->ServerName, "PRIVMSG %s :\2%s\2: %s", c->name, type.c_str(), msg.c_str());
+                       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, buf);
+                       ServerInstance->PI->SendChannelPrivmsg(c, 0, buf);
                }
        }
 };
@@ -64,13 +67,18 @@ class ModuleChanLog : public Module
                std::vector<ChannelLogStream*>().swap(cls);
                int index, max = Conf->Enumerate("log");
                cls.reserve(max);
+
                for (index = 0; index < max; ++index)
                {
                        std::string method = Conf->ReadValue("log", "method", index);
-                       if (method != "file") continue;
+
+                       if (method != "file")
+                               continue;
+
                        std::string type = Conf->ReadValue("log", "type", index);
                        std::string level = Conf->ReadValue("log", "level", index);
                        int loglevel = DEFAULT;
+
                        if (level == "debug")
                        {
                                loglevel = DEBUG;
@@ -92,6 +100,7 @@ class ModuleChanLog : public Module
                        {
                                loglevel = NONE;
                        }
+
                        std::string target = Conf->ReadValue("log", "target", index);
                        ChannelLogStream* c = new ChannelLogStream(ServerInstance, loglevel, target);
                        ServerInstance->Logs->AddLogTypes(type, c, true);