diff options
-rw-r--r-- | src/channels.cpp | 46 | ||||
-rw-r--r-- | src/modules.cpp | 2 |
2 files changed, 17 insertions, 31 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 0e45de33f..d7f8f372e 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -135,6 +135,22 @@ void Channel::DelUser(User* user) delete a->second; userlist.erase(a); } + + if (userlist.empty()) + { + 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); + } + ServerInstance->GlobalCulls.AddItem(this); + } } bool Channel::HasUser(User* user) @@ -466,21 +482,6 @@ void Channel::PartUser(User *user, std::string &reason) } this->DelUser(user); - if (userlist.empty()) - { - 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); - } - ServerInstance->GlobalCulls.AddItem(this); - } } void Channel::ServerKickUser(User* user, const char* reason, const std::string& servername) @@ -545,21 +546,6 @@ void Channel::KickUser(User *src, User *user, const char* reason) } this->DelUser(user); - if (userlist.empty()) - { - 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); - } - ServerInstance->GlobalCulls.AddItem(this); - } } void Channel::WriteChannel(User* user, const char* text, ...) diff --git a/src/modules.cpp b/src/modules.cpp index eb76897a2..a0eb9e19e 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -480,7 +480,7 @@ void ModuleManager::DoSafeUnload(Module* mod) mod->OnCleanup(TYPE_USER,u->second); u->second->doUnhookExtensions(items); } - for(char m='A'; m < 'z'; m++) + for(char m='A'; m <= 'z'; m++) { ModeHandler* mh; mh = ServerInstance->Modes->FindMode(m, MODETYPE_USER); |