]> 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 8d48f324c170837990a03b609c974c0e165ea768..f7c05572f3263dabfd8757ff1686d75608d9b4da 100644 (file)
@@ -163,7 +163,7 @@ class ChanFounder : public ModeHandler, public FounderProtectBase
 {
        char* dummyptr;
  public:
-       ChanFounder(InspIRCd* Instance, bool using_prefixes, bool depriv_self)
+       ChanFounder(InspIRCd* Instance, bool using_prefixes, bool &depriv_self)
                : ModeHandler(Instance, 'q', 1, 1, true, MODETYPE_CHANNEL, false, using_prefixes ? '~' : 0),
                  FounderProtectBase(Instance, "cm_founder_", "founder", 386, 387, depriv_self) { }
 
@@ -221,7 +221,7 @@ class ChanProtect : public ModeHandler, public FounderProtectBase
 {
        char* dummyptr;
  public:
-       ChanProtect(InspIRCd* Instance, bool using_prefixes, bool depriv_self)
+       ChanProtect(InspIRCd* Instance, bool using_prefixes, bool &depriv_self)
                : ModeHandler(Instance, 'a', 1, 1, true, MODETYPE_CHANNEL, false, using_prefixes ? '&' : 0),
                  FounderProtectBase(Instance,"cm_protect_","protected user", 388, 389, depriv_self) { }
 
@@ -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.");