X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chanfilter.cpp;h=c90d765409ce5e0ec2f5d2b8687e581640032fcf;hb=551d687ec6d7ce44be35fae0dd7345fe73c4f63a;hp=e6585e524cc9d51050659789942eb1dada2e770f;hpb=fcacc8e0306382bc3f938073092c3729d77e2b41;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index e6585e524..c90d76540 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -23,13 +23,13 @@ */ +/* $ModDesc: Provides channel-specific censor lists (like mode +G but varies from channel to channel) */ + #define _CRT_SECURE_NO_DEPRECATE #define _SCL_SECURE_NO_DEPRECATE #include "inspircd.h" -#include "u_listmode.h" - -/* $ModDesc: Provides channel-specific censor lists (like mode +G but varies from channel to channel) */ +#include "listmode.h" /** Handles channel mode +g */ @@ -49,10 +49,9 @@ class ChanFilter : public ListModeBase return true; } - virtual bool TellListTooLong(User* user, Channel* chan, std::string &word) + virtual void TellListTooLong(User* user, Channel* chan, std::string &word) { user->WriteNumeric(939, "%s %s %s :Channel spamfilter list is full", user->nick.c_str(), chan->name.c_str(), word.c_str()); - return true; } virtual void TellAlreadyOnList(User* user, Channel* chan, std::string &word) @@ -76,20 +75,22 @@ class ModuleChanFilter : public Module ModuleChanFilter() : cf(this) { - if (!ServerInstance->Modes->AddMode(&cf)) - throw ModuleException("Could not add new modes!"); + } + + void init() + { + ServerInstance->Modules->AddService(cf); cf.DoImplements(this); Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, I_OnSyncChannel }; - ServerInstance->Modules->Attach(eventlist, this, 4); + ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } virtual void OnRehash(User* user) { - ConfigReader Conf; - hidemask = Conf.ReadFlag("chanfilter", "hidemask", 0); + hidemask = ServerInstance->Config->ConfValue("chanfilter")->getBool("hidemask"); cf.DoRehash(); } @@ -100,11 +101,11 @@ class ModuleChanFilter : public Module if (!IS_LOCAL(user) || res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; - modelist* list = cf.extItem.get(chan); + ListModeBase::ModeList* list = cf.GetList(chan); if (list) { - for (modelist::iterator i = list->begin(); i != list->end(); i++) + for (ListModeBase::ModeList::iterator i = list->begin(); i != list->end(); i++) { if (InspIRCd::Match(text, i->mask)) { @@ -129,11 +130,6 @@ class ModuleChanFilter : public Module return MOD_RES_PASSTHRU; } - virtual void OnCleanup(int target_type, void* item) - { - cf.DoCleanup(target_type, item); - } - virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) { return OnUserPreMessage(user,dest,target_type,text,status,exempt_list); @@ -148,10 +144,6 @@ class ModuleChanFilter : public Module { return Version("Provides channel-specific censor lists (like mode +G but varies from channel to channel)", VF_VENDOR); } - - virtual ~ModuleChanFilter() - { - } }; MODULE_INIT(ModuleChanFilter)