]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_stripcolor.cpp
Tidyup
[user/henk/code/inspircd.git] / src / modules / m_stripcolor.cpp
index d3372d848d2d17a9591d9d28bd13ad026e8b5c04..3537c899d4e94634bee47df47353322cc34a8116 100644 (file)
 
 using namespace std;
 
-#include <stdio.h>
-#include <string>
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
-
 #include "inspircd.h"
 
 /* $ModDesc: Provides channel +S mode (strip ansi colour) */
 
-
-
+/** Handles channel mode +S
+ */
 class ChannelStripColor : public ModeHandler
 {
  public:
@@ -35,10 +32,6 @@ class ChannelStripColor : public ModeHandler
 
        ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
        {
-               /* Only opers can change other users modes */
-               if ((source != dest) && (!*source->oper))
-                       return MODEACTION_DENY;
-
                if (adding)
                {
                        if (!channel->IsModeSet('S'))
@@ -60,6 +53,8 @@ class ChannelStripColor : public ModeHandler
        }
 };
 
+/** Handles user mode +S
+ */
 class UserStripColor : public ModeHandler
 {
  public:
@@ -115,15 +110,13 @@ class ModuleStripColor : public Module
 
        void Implements(char* List)
        {
-               List[I_On005Numeric] = List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1;
+               List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1;
        }
 
-       virtual void On005Numeric(std::string &output)
-       {
-       }
-       
        virtual ~ModuleStripColor()
        {
+               ServerInstance->Modes->DelMode(usc);
+               ServerInstance->Modes->DelMode(csc);
                DELETE(usc);
                DELETE(csc);
        }
@@ -183,7 +176,7 @@ class ModuleStripColor : public Module
                text = sentence;
        }
        
-       virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status)
+       virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
        {
                bool active = false;
                if (target_type == TYPE_USER)
@@ -203,15 +196,14 @@ class ModuleStripColor : public Module
                return 0;
        }
        
-       virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status)
+       virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
        {
-               return OnUserPreMessage(user,dest,target_type,text,status);
+               return OnUserPreMessage(user,dest,target_type,text,status,exempt_list);
        }
        
        virtual Version GetVersion()
        {
-               // This is version 2 because version 1.x is the unreleased unrealircd module
-               return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
+               return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
        }
        
 };