From 05cc48f1894e40f8a34496bf54a60d8b911e6a5e Mon Sep 17 00:00:00 2001 From: w00t Date: Fri, 4 Apr 2008 14:45:25 +0000 Subject: [PATCH] Modify chanlog to send message remotely, too. Logging now works server <-> server, so a whole network can log stuff to a single channel. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9310 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_chanlog.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index 56b9ec689..eb2fe8118 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -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().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); -- 2.39.5