summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-04 14:45:25 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-04 14:45:25 +0000
commit05cc48f1894e40f8a34496bf54a60d8b911e6a5e (patch)
tree6a2b01868015a897954d60ca21ad66e564dc4788 /src/modules
parent8fc3c90385f2c2a327e1cfbe47bf959802177d40 (diff)
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
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_chanlog.cpp15
1 files 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<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);