]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chanprotect.cpp
Remove some debug (im on a crusade to make debug mode useful, but at the same time...
[user/henk/code/inspircd.git] / src / modules / m_chanprotect.cpp
index 9f5a4eba347c8b253805658aaa06f3390ea7a5c6..f7c05572f3263dabfd8757ff1686d75608d9b4da 100644 (file)
@@ -290,7 +290,7 @@ class ModuleChanProtect : public Module
                : Module::Module(Me), FirstInGetsFounder(false), QAPrefixes(false), DeprivSelf(false), booting(true)
        {       
                /* Load config stuff */
-               OnRehash("");
+               OnRehash(NULL,"");
                booting = false;
 
                /* Initialise module variables */
@@ -298,8 +298,8 @@ class ModuleChanProtect : public Module
                cp = new ChanProtect(ServerInstance,QAPrefixes,DeprivSelf);
                cf = new ChanFounder(ServerInstance,QAPrefixes,DeprivSelf);
 
-               ServerInstance->AddMode(cp, 'a');
-               ServerInstance->AddMode(cf, 'q');
+               if (!ServerInstance->AddMode(cp, 'a') || !ServerInstance->AddMode(cf, 'q'))
+                       throw ModuleException("Could not add new modes!");
        }
 
        void Implements(char* List)
@@ -321,7 +321,7 @@ class ModuleChanProtect : public Module
                user->Shrink("cm_protect_"+std::string(channel->name));
        }
 
-       virtual void OnRehash(const std::string &parameter)
+       virtual void OnRehash(userrec* user, const std::string &parameter)
        {
                /* Create a configreader class and read our flag,
                 * in old versions this was heap-allocated and the
@@ -348,6 +348,7 @@ class ModuleChanProtect : public Module
                        DELETE(cf);
                        cp = new ChanProtect(ServerInstance,QAPrefixes,DeprivSelf);
                        cf = new ChanFounder(ServerInstance,QAPrefixes,DeprivSelf);
+                       /* These wont fail, we already owned the mode characters before */
                        ServerInstance->AddMode(cp, 'a');
                        ServerInstance->AddMode(cf, 'q');
                        ServerInstance->WriteOpers("*** WARNING: +qa prefixes were enabled or disabled via a REHASH. Clients will probably need to reconnect to pick up this change.");