]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_blockcolor.cpp
fixed some indentation and spacing in modules
[user/henk/code/inspircd.git] / src / modules / m_blockcolor.cpp
index f10d50b74b7c657dba84b8af7c88d7c55e99973c..3943e436d4cf7892589d4281e92cded065f4f6da 100644 (file)
 
 /** Handles the +c channel mode
  */
-class BlockColor : public ModeHandler
+class BlockColor : public SimpleChannelModeHandler
 {
  public:
-       BlockColor(InspIRCd* Instance) : ModeHandler(Instance, 'c', 0, 0, false, MODETYPE_CHANNEL, false) { }
-
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
-       {
-               if (adding)
-               {
-                       if (!channel->IsModeSet('c'))
-                       {
-                               channel->SetMode('c',true);
-                               return MODEACTION_ALLOW;
-                       }
-               }
-               else
-               {
-                       if (channel->IsModeSet('c'))
-                       {
-                               channel->SetMode('c',false);
-                               return MODEACTION_ALLOW;
-                       }
-               }
-
-               return MODEACTION_DENY;
-       }
+       BlockColor(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'c') { }
 };
 
 class ModuleBlockColour : public Module
 {
-       bool AllowChanOps;      
+       bool AllowChanOps;
        BlockColor *bc;
  public:
+
        ModuleBlockColour(InspIRCd* Me) : Module(Me)
        {
                bc = new BlockColor(ServerInstance);
@@ -72,7 +50,7 @@ class ModuleBlockColour : public Module
                        {
                                return 0;
                        }
-                       
+
                        if(c->IsModeSet('c'))
                        {
                                for (std::string::iterator i = text.begin(); i != text.end(); i++)
@@ -85,7 +63,7 @@ class ModuleBlockColour : public Module
                                                case 21:
                                                case 22:
                                                case 31:
-                                                       user->WriteServ("404 %s %s :Can't send colours to channel (+c set)",user->nick, c->name);
+                                                       user->WriteNumeric(404, "%s %s :Can't send colours to channel (+c set)",user->nick.c_str(), c->name.c_str());
                                                        return 1;
                                                break;
                                        }
@@ -94,7 +72,7 @@ class ModuleBlockColour : public Module
                }
                return 0;
        }
-       
+
        virtual int 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);
@@ -105,10 +83,10 @@ class ModuleBlockColour : public Module
                ServerInstance->Modes->DelMode(bc);
                delete bc;
        }
-       
+
        virtual Version GetVersion()
        {
-               return Version(1,1,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
+               return Version(1,2,0,0,VF_COMMON|VF_VENDOR,API_VERSION);
        }
 };