]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_botmode.cpp
Fix iteration of ServerInstance->Users->local_users now that QuitUser can modify...
[user/henk/code/inspircd.git] / src / modules / m_botmode.cpp
index 7e8993cb363b02042afbd4d93c695626a73de08a..0940a2147e43543dd291d194c9763496d6498fd7 100644 (file)
 class BotMode : public SimpleUserModeHandler
 {
  public:
-       BotMode(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'B') { }
+       BotMode(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Creator, 'B') { }
 };
 
 class ModuleBotMode : public Module
 {
-
-       BotMode* bm;
+       BotMode bm;
  public:
        ModuleBotMode(InspIRCd* Me)
-               : Module(Me)
+               : Module(Me), bm(Me, this)
        {
-
-               bm = new BotMode(ServerInstance);
-               if (!ServerInstance->Modes->AddMode(bm))
+               if (!ServerInstance->Modes->AddMode(&bm))
                        throw ModuleException("Could not add new modes!");
                Implementation eventlist[] = { I_OnWhois };
                ServerInstance->Modules->Attach(eventlist, this, 1);
@@ -42,8 +39,7 @@ class ModuleBotMode : public Module
 
        virtual ~ModuleBotMode()
        {
-               ServerInstance->Modes->DelMode(bm);
-               delete bm;
+               ServerInstance->Modes->DelMode(&bm);
        }
 
        virtual Version GetVersion()