X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_permchannels.cpp;h=a9c4c8a72779e84602285f854efb31baa9e2bb10;hb=de69e28a4a1aea89e410b693bbbb67890ecb0bd3;hp=a409078e4ab29eb5c41bb940ae156e6ede168c34;hpb=ee913368d7162dbe0dd119091f8b468eb7be0f1a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index a409078e4..a9c4c8a72 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -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 ¶meter, bool adding) { @@ -179,15 +179,14 @@ public: { if (!ServerInstance->Modes->AddMode(&p)) throw ModuleException("Could not add new modes!"); - Implementation eventlist[] = { I_OnChannelPreDelete, I_OnPostTopicChange, I_OnRawMode }; - ServerInstance->Modules->Attach(eventlist, this, 3); + Implementation eventlist[] = { I_OnChannelPreDelete, I_OnPostTopicChange, I_OnRawMode, I_OnRehash }; + ServerInstance->Modules->Attach(eventlist, this, 4); OnRehash(NULL); } - virtual ~ModulePermanentChannels() + CullResult cull() { - ServerInstance->Modes->DelMode(&p); /* * DelMode can't remove the +P mode on empty channels, or it will break * merging modes with remote servers. Remove the empty channels now as @@ -201,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) @@ -293,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)