]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_blockcolor.cpp
Fix these too
[user/henk/code/inspircd.git] / src / modules / m_blockcolor.cpp
index 4013949d6b0c4d96d6dad34a4d391c1d23019bad..d48fab5bac10bf74014813fcca365cd5490b4b31 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
@@ -85,7 +63,7 @@ class ModuleBlockColour : public Module
                                                case 21:
                                                case 22:
                                                case 31:
-                                                       user->WriteNumeric(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);
                                                        return 1;
                                                break;
                                        }
@@ -108,7 +86,7 @@ class ModuleBlockColour : public Module
        
        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);
        }
 };