X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_noctcp.cpp;h=e9733cf543699ef4730fde4d663f32ad6851a408;hb=565544fac966b14e046bb3042ab485f79bcf7c9e;hp=d791dca365ab363378a21d965fddffd15ac76f05;hpb=d24619c012b34d5a3d4cfb93e7bea3ff3d5721e7;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index d791dca36..e9733cf54 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -20,26 +20,18 @@ #include "inspircd.h" - -class NoCTCP : public SimpleChannelModeHandler -{ - public: - NoCTCP(Module* Creator) : SimpleChannelModeHandler(Creator, "noctcp", 'C') { } -}; +#include "modules/exemption.h" class ModuleNoCTCP : public Module { - NoCTCP nc; + CheckExemption::EventProvider exemptionprov; + SimpleChannelModeHandler nc; public: ModuleNoCTCP() - : nc(this) - { - } - - void init() CXX11_OVERRIDE + : exemptionprov(this) + , nc(this, "noctcp", 'C') { - ServerInstance->Modules->AddService(nc); } Version GetVersion() CXX11_OVERRIDE @@ -52,16 +44,16 @@ class ModuleNoCTCP : public Module if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user))) { Channel* c = (Channel*)dest; - if ((text.empty()) || (text[0] != '\001') || (!strncmp(text.c_str(),"\1ACTION ",8))) + if ((text.empty()) || (text[0] != '\001') || (!strncmp(text.c_str(),"\1ACTION ", 8)) || (text == "\1ACTION\1") || (text == "\1ACTION")) return MOD_RES_PASSTHRU; - ModResult res = ServerInstance->OnCheckExemption(user,c,"noctcp"); + ModResult res = CheckExemption::Call(exemptionprov, user, c, "noctcp"); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; if (!c->GetExtBanStatus(user, 'C').check(!c->IsModeSet(nc))) { - user->WriteNumeric(ERR_NOCTCPALLOWED, "%s %s :Can't send CTCP to channel (+C set)",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_NOCTCPALLOWED, c->name, "Can't send CTCP to channel (+C set)"); return MOD_RES_DENY; } }