]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_permchannels.cpp
Fix interaction of m_permchannels post-cull and channel empty-by-quit that causes...
[user/henk/code/inspircd.git] / src / modules / m_permchannels.cpp
index 7fdc12f882ebb69e48725a7e874ea58f85fbc8a7..53004ff79bf9406c3d192e211c22759b77dabb4b 100644 (file)
@@ -110,7 +110,7 @@ static bool WriteDatabase()
 class PermChannel : public ModeHandler
 {
  public:
-       PermChannel(Module* Creator) : ModeHandler(Creator, 'P', PARAM_NONE, MODETYPE_CHANNEL) { }
+       PermChannel(Module* Creator) : ModeHandler(Creator, "permanent", 'P', PARAM_NONE, MODETYPE_CHANNEL) { }
 
        ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
        {
@@ -185,7 +185,7 @@ public:
                OnRehash(NULL);
        }
 
-       virtual ~ModulePermanentChannels()
+       CullResult cull()
        {
                /*
                 * DelMode can't remove the +P mode on empty channels, or it will break
@@ -200,12 +200,15 @@ public:
                        {
                                chan_hash::iterator at = iter;
                                iter++;
+                               FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(c));
                                ServerInstance->chanlist->erase(at);
-                               delete c;
+                               ServerInstance->GlobalCulls.AddItem(c);
                        }
                        else
                                iter++;
                }
+               ServerInstance->Modes->DelMode(&p);
+               return Module::cull();
        }
 
        virtual void OnRehash(User *user)
@@ -292,7 +295,7 @@ public:
 
        virtual Version GetVersion()
        {
-               return Version("Provides support for channel mode +P to provide permanent channels",VF_COMMON|VF_VENDOR,API_VERSION);
+               return Version("Provides support for channel mode +P to provide permanent channels",VF_COMMON|VF_VENDOR);
        }
 
        virtual ModResult OnChannelPreDelete(Channel *c)