]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_censor.cpp
Fix unsafe iteration in m_timedbans
[user/henk/code/inspircd.git] / src / modules / m_censor.cpp
index faf2a4200334d9dcd51654e0e67950d7c7f83313..bf1f0225dcba4bfc597de9248b79c6bcda196237 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -26,7 +26,7 @@ typedef std::map<irc::string,irc::string> censor_t;
 class CensorUser : public SimpleUserModeHandler
 {
  public:
-       CensorUser(Module* Creator) : SimpleUserModeHandler(Creator, "censor", 'G') { }
+       CensorUser(Module* Creator) : SimpleUserModeHandler(Creator, "u_censor", 'G') { }
 };
 
 /** Handles channel mode +G
@@ -44,16 +44,17 @@ class ModuleCensor : public Module
        CensorChannel cc;
 
  public:
-       ModuleCensor()
-               : cu(this), cc(this)
+       ModuleCensor() : cu(this), cc(this) { }
+
+       void init()
        {
                /* Read the configuration file on startup.
                 */
                OnRehash(NULL);
-               if (!ServerInstance->Modes->AddMode(&cu) || !ServerInstance->Modes->AddMode(&cc))
-                       throw ModuleException("Could not add new modes!");
-               Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, I_OnRunTestSuite };
-               ServerInstance->Modules->Attach(eventlist, this, 4);
+               ServerInstance->Modules->AddService(cu);
+               ServerInstance->Modules->AddService(cc);
+               Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice };
+               ServerInstance->Modules->Attach(eventlist, this, 3);
        }
 
 
@@ -75,8 +76,7 @@ class ModuleCensor : public Module
                {
                        active = ((Channel*)dest)->IsModeSet('G');
                        Channel* c = (Channel*)dest;
-                       ModResult res;
-                       FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"censor"));
+                       ModResult res = ServerInstance->OnCheckExemption(user,c,"censor");
 
                        if (res == MOD_RES_ALLOW)
                                return MOD_RES_PASSTHRU;
@@ -127,7 +127,7 @@ class ModuleCensor : public Module
 
        virtual Version GetVersion()
        {
-               return Version("Provides user and channel +G mode",VF_COMMON|VF_VENDOR);
+               return Version("Provides user and channel +G mode",VF_VENDOR);
        }
 
 };