CullResult cull() { /* * 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 * we know this is not the case. */ chan_hash::iterator iter = ServerInstance->chanlist->begin(); while (iter != ServerInstance->chanlist->end()) { Channel* c = iter->second; if (c->GetUserCounter() == 0) { chan_hash::iterator at = iter; iter++; FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(c)); ServerInstance->chanlist->erase(at); ServerInstance->GlobalCulls.AddItem(c); } else iter++; } ServerInstance->Modes->DelMode(&p); return Module::cull(); }
void Channel::CheckDestroy() { if (!userlist.empty()) return; ModResult res; FIRST_MOD_RESULT(OnChannelPreDelete, res, (this)); if (res == MOD_RES_DENY) return; chan_hash::iterator iter = ServerInstance->chanlist->find(this->name); /* kill the record */ if (iter != ServerInstance->chanlist->end()) { FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(this)); ServerInstance->chanlist->erase(iter); } ClearInvites(); ServerInstance->GlobalCulls.AddItem(this); }
virtual void OnCleanup(int target_type, void* item) { if(target_type == TYPE_CHANNEL) OnChannelDelete((chanrec*)item); }