diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-20 04:40:50 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-20 04:40:50 +0000 |
commit | 7bb73d2e63c1ec31a2af58b57c05bbce39c4dd59 (patch) | |
tree | 171fa519a338f2f00c0b667b6ce2c3b7c402dcd7 /src/channels.cpp | |
parent | 9b8c61e7e73b6bac60adeb3aa4f4d8127b813558 (diff) |
Fix channel deletion on user quit and automatic removal of mode "z"
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11934 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 46 |
1 files changed, 16 insertions, 30 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, ...) |