]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_noctcp.cpp
m_cgiirc De-duplicate code, recheck elines after ip/host changes
[user/henk/code/inspircd.git] / src / modules / m_noctcp.cpp
index b739505798fd5da617f751876ccb2f54cb96b334..b6044b3fecadd4ca2640d189b4832e7a23ddcc51 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "inspircd.h"
 
-/* $ModDesc: Provides support for unreal-style channel mode +C */
+/* $ModDesc: Provides channel mode +C to block CTCPs */
 
 class NoCTCP : public SimpleChannelModeHandler
 {
@@ -51,7 +51,7 @@ class ModuleNoCTCP : public Module
 
        virtual Version GetVersion()
        {
-               return Version("Provides support for unreal-style channel mode +C", VF_VENDOR);
+               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)
@@ -64,17 +64,14 @@ class ModuleNoCTCP : public Module
                if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
                {
                        Channel* c = (Channel*)dest;
-                       if (!c->IsModeSet('C'))
-                               return MOD_RES_PASSTHRU;
-
-                       if ((text.empty()) || (text[0] != '\001') || (strncmp(text.c_str(),"\1ACTION ",8)))
+                       if ((text.empty()) || (text[0] != '\001') || (!strncmp(text.c_str(),"\1ACTION ",8)))
                                return MOD_RES_PASSTHRU;
 
                        ModResult res = ServerInstance->OnCheckExemption(user,c,"noctcp");
                        if (res == MOD_RES_ALLOW)
                                return MOD_RES_PASSTHRU;
 
-                       if (!c->GetExtBanStatus(user, 'C'))
+                       if (!c->GetExtBanStatus(user, 'C').check(!c->IsModeSet('C')))
                        {
                                user->WriteNumeric(ERR_NOCTCPALLOWED, "%s %s :Can't send CTCP to channel (+C set)",user->nick.c_str(), c->name.c_str());
                                return MOD_RES_DENY;