]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_stripcolor.cpp
Fix some valgrind warnings
[user/henk/code/inspircd.git] / src / modules / m_stripcolor.cpp
index ce98103e1d934ffe8a1d8deb9bfab44ff52eb781..34662c45b1e1761d868a9396365d525b26d786f7 100644 (file)
@@ -20,7 +20,7 @@
 class ChannelStripColor : public SimpleChannelModeHandler
 {
  public:
-       ChannelStripColor(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'S') { }
+       ChannelStripColor(Module* Creator) : SimpleChannelModeHandler(Creator, 'S') { }
 };
 
 /** Handles user mode +S
@@ -28,7 +28,7 @@ class ChannelStripColor : public SimpleChannelModeHandler
 class UserStripColor : public SimpleUserModeHandler
 {
  public:
-       UserStripColor(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Instance, Creator, 'S') { }
+       UserStripColor(Module* Creator) : SimpleUserModeHandler(Creator, 'S') { }
 };
 
 
@@ -39,7 +39,7 @@ class ModuleStripColor : public Module
        UserStripColor usc;
 
  public:
-       ModuleStripColor(InspIRCd* Me) : Module(Me), csc(Me, this), usc(Me, this)
+       ModuleStripColor() : csc(this), usc(this)
        {
                if (!ServerInstance->Modes->AddMode(&usc) || !ServerInstance->Modes->AddMode(&csc))
                        throw ModuleException("Could not add new modes!");
@@ -98,10 +98,10 @@ class ModuleStripColor : public Module
                }
        }
 
-       virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+       virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
        {
                if (!IS_LOCAL(user))
-                       return 0;
+                       return MOD_RES_PASSTHRU;
 
                bool active = false;
                if (target_type == TYPE_USER)
@@ -115,12 +115,12 @@ class ModuleStripColor : public Module
 
                        // check if we allow ops to bypass filtering, if we do, check if they're opped accordingly.
                        // note: short circut logic here, don't wreck it. -- w00t
-                       if (CHANOPS_EXEMPT(ServerInstance, 'S') && t->GetStatus(user) == STATUS_OP)
+                       if (CHANOPS_EXEMPT('S') && t->GetPrefixValue(user) == OP_VALUE)
                        {
-                               return 0;
+                               return MOD_RES_PASSTHRU;
                        }
 
-                       active = t->IsModeSet('S') || t->GetExtBanStatus(user, 'S') < 0;
+                       active = !t->GetExtBanStatus(user, 'S').check(!t->IsModeSet('S'));
                }
 
                if (active)
@@ -128,17 +128,17 @@ class ModuleStripColor : public Module
                        this->ReplaceLine(text);
                }
 
-               return 0;
+               return MOD_RES_PASSTHRU;
        }
 
-       virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
+       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);
        }
 
        virtual Version GetVersion()
        {
-               return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version("Provides channel +S mode (strip ansi colour)", VF_COMMON | VF_VENDOR, API_VERSION);
        }
 
 };