]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_blockcolor.cpp
Remote /MAP: caution, this doesn't compile
[user/henk/code/inspircd.git] / src / modules / m_blockcolor.cpp
index 0cbb3e8d8e7dddd30dd0604819aa5cd36c4da461..a6a255e23f093ff7e0046dda74ad0e9ce2285dfa 100644 (file)
@@ -22,7 +22,7 @@ class BlockColor : public ModeHandler
  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)
+       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
        {
                if (adding)
                {
@@ -67,25 +67,27 @@ class ModuleBlockColour : public Module
                if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
                {
                        Channel* c = (Channel*)dest;
+
+                       if (CHANOPS_EXEMPT(ServerInstance, 'c') && c->GetStatus(user) == STATUS_OP)
+                       {
+                               return 0;
+                       }
                        
                        if(c->IsModeSet('c'))
                        {
-                               if (!CHANOPS_EXEMPT(ServerInstance, 'c') || CHANOPS_EXEMPT(ServerInstance, 'c') && c->GetStatus(user) != STATUS_OP)
+                               for (std::string::iterator i = text.begin(); i != text.end(); i++)
                                {
-                                       for (std::string::iterator i = text.begin(); i != text.end(); i++)
+                                       switch (*i)
                                        {
-                                               switch (*i)
-                                               {
-                                                       case 2:
-                                                       case 3:
-                                                       case 15:
-                                                       case 21:
-                                                       case 22:
-                                                       case 31:
-                                                               user->WriteServ("404 %s %s :Can't send colours to channel (+c set)",user->nick, c->name);
-                                                               return 1;
-                                                       break;
-                                               }
+                                               case 2:
+                                               case 3:
+                                               case 15:
+                                               case 21:
+                                               case 22:
+                                               case 31:
+                                                       user->WriteNumeric(404, "%s %s :Can't send colours to channel (+c set)",user->nick, c->name);
+                                                       return 1;
+                                               break;
                                        }
                                }
                        }
@@ -106,7 +108,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);
        }
 };