]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_banredirect.cpp
Change allocation of commands/modes
[user/henk/code/inspircd.git] / src / modules / m_banredirect.cpp
index 8e9319bcf7f97ec7c8f87ad7b78d46dfba5ea396..bec69e60840964484dd30000a62d4ecec0ac31fe 100644 (file)
@@ -195,24 +195,20 @@ class BanRedirect : public ModeWatcher
 
 class ModuleBanRedirect : public Module
 {
-       BanRedirect* re;
+       BanRedirect re;
        bool nofollow;
        Module* ExceptionModule;
 
  public:
        ModuleBanRedirect(InspIRCd* Me)
-       : Module(Me)
+       : Module(Me), re(Me)
        {
-               re = new BanRedirect(Me);
                nofollow = false;
 
-               if(!ServerInstance->Modes->AddModeWatcher(re))
-               {
-                       delete re;
+               if(!ServerInstance->Modes->AddModeWatcher(&re))
                        throw ModuleException("Could not add mode watcher");
-               }
 
-               OnRehash(NULL, "");
+               OnRehash(NULL);
 
                Implementation list[] = { I_OnRehash, I_OnUserPreJoin, I_OnChannelDelete, I_OnCleanup };
                Me->Modules->Attach(list, this, 4);
@@ -262,7 +258,7 @@ class ModuleBanRedirect : public Module
                }
        }
 
-       virtual void OnRehash(User* user, const std::string &param)
+       virtual void OnRehash(User* user)
        {
                ExceptionModule = ServerInstance->Modules->Find("m_banexception.so");
        }
@@ -333,8 +329,7 @@ class ModuleBanRedirect : public Module
 
        virtual ~ModuleBanRedirect()
        {
-               ServerInstance->Modes->DelModeWatcher(re);
-               delete re;
+               ServerInstance->Modes->DelModeWatcher(&re);
        }
 
        virtual Version GetVersion()