]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_noctcp.cpp
Merge branch 'insp20' into master.
[user/henk/code/inspircd.git] / src / modules / m_noctcp.cpp
index d791dca365ab363378a21d965fddffd15ac76f05..e9733cf543699ef4730fde4d663f32ad6851a408 100644 (file)
 
 
 #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;
                        }
                }