]> 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 1b1ebba40a3e0e53385a998127262a884820b4dd..f7c05572f3263dabfd8757ff1686d75608d9b4da 100644 (file)
@@ -2,14 +2,11 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- *                    E-mail:
- *             <brain@chatspike.net>
- *               <Craig@chatspike.net>
- *     
- * Written by Craig Edwards, Craig McLure, and others.
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
  * This program is free but copyrighted software; see
- *         the file COPYING for details.
+ *            the file COPYING for details.
  *
  * ---------------------------------------------------
  */
@@ -166,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) { }
 
@@ -224,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) { }
 
@@ -293,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 */
@@ -301,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)
@@ -324,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
@@ -351,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.");