X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chanfilter.cpp;h=e21ac8ca41837d98c68048718141d7a995f27075;hb=7f00015727fab50e37de46aa90d218b31c852c87;hp=139f800823f2a14b6fc8d10b6c5921928294800a;hpb=7f9c6c5118261eac40d9bae22ac2c0ede670512d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 139f80082..e21ac8ca4 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -2,20 +2,15 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * - * - * - * Written by Craig Edwards, Craig McLure, and others. + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * * This program is free but copyrighted software; see * the file COPYING for details. * * --------------------------------------------------- */ -using namespace std; - #include #include #include @@ -27,6 +22,7 @@ using namespace std; #include "inspircd.h" /* $ModDesc: Provides channel-specific censor lists (like mode +G but varies from channel to channel) */ +/* $ModDep: ../../include/u_listmode.h */ /** Handles channel mode +g */ @@ -37,9 +33,9 @@ class ChanFilter : public ListModeBase virtual bool ValidateParam(userrec* user, chanrec* chan, std::string &word) { - if (word.length() > 35) + if ((word.length() > 35) || (word.empty())) { - user->WriteServ( "935 %s %s %s :word is too long for censor list",user->nick, chan->name,word.c_str()); + user->WriteServ("935 %s %s %s :word is too %s for censor list",user->nick, chan->name,word.c_str(), (word.empty() ? "short" : "long")); return false; } @@ -74,7 +70,8 @@ class ModuleChanFilter : public Module : Module::Module(Me) { cf = new ChanFilter(ServerInstance); - ServerInstance->AddMode(cf, 'g'); + if (!ServerInstance->AddMode(cf, 'g')) + throw ModuleException("Could not add new modes!"); } void Implements(char* List) @@ -88,13 +85,16 @@ class ModuleChanFilter : public Module cf->DoChannelDelete(chan); } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { cf->DoRehash(); } virtual int ProcessMessages(userrec* user,chanrec* chan,std::string &text) { + if (!IS_LOCAL(user)) + return 0; + // Create a copy of the string in irc::string irc::string line = text.c_str(); @@ -115,7 +115,7 @@ class ModuleChanFilter : public Module return 0; } - virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status) + virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { if (target_type == TYPE_CHANNEL) { @@ -129,9 +129,9 @@ class ModuleChanFilter : public Module cf->DoCleanup(target_type, item); } - virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status) + virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { - return OnUserPreMessage(user,dest,target_type,text,status); + return OnUserPreMessage(user,dest,target_type,text,status,exempt_list); } virtual void OnSyncChannel(chanrec* chan, Module* proto, void* opaque)