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)
{
{
if (channel->IsModeSet('P'))
{
- if (channel->GetUserCounter() == 0 && !IS_FAKE(source))
+ if (channel->GetUserCounter() == 0 && !IS_SERVER(source))
{
/*
* ugh, ugh, UGH!
{
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
{
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)
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)