X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_noctcp.cpp;h=29b548e1c65a399ede9f2ff23eaede3b83c43823;hb=7a67685bcb863b0d4199715e86697fee423596c2;hp=144ac312b145641bdf1f1413fc46b4ab47b63f63;hpb=ac7defcd3e52695dcf5e5150e9fe3e1624205e64;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 144ac312b..29b548e1c 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -31,39 +31,27 @@ class NoCTCP : public SimpleChannelModeHandler class ModuleNoCTCP : public Module { - NoCTCP nc; public: - ModuleNoCTCP() : nc(this) { } - void init() - { - if (!ServerInstance->Modes->AddMode(&nc)) - throw ModuleException("Could not add new modes!"); - Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, 3); - } - - virtual ~ModuleNoCTCP() + void init() CXX11_OVERRIDE { + ServerInstance->Modules->AddService(nc); + Implementation eventlist[] = { I_OnUserPreMessage, I_On005Numeric }; + ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } - virtual Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Provides channel mode +C to block CTCPs", VF_VENDOR); } - virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) - { - return OnUserPreNotice(user,dest,target_type,text,status,exempt_list); - } - - virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) + ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE { if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user))) { @@ -84,9 +72,9 @@ class ModuleNoCTCP : public Module return MOD_RES_PASSTHRU; } - virtual void On005Numeric(std::string &output) + void On005Numeric(std::map& tokens) CXX11_OVERRIDE { - ServerInstance->AddExtBanChar('C'); + tokens["EXTBAN"].push_back('C'); } };