X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chanlog.cpp;h=9528a94de65a4d637be932ad6473b7da16b29c34;hb=f14271bdb80dd6af67cde4fb97df9716613a7177;hp=bb5adf67c32f2e34253cdbd6cda1b1419ccba0c9;hpb=d0be7981e62a73d71cf9ffe534b245584aa27a36;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index bb5adf67c..9528a94de 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -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 @@ -15,51 +15,6 @@ /* $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 +