diff options
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 91f9b8072..2807249c1 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -502,28 +502,19 @@ void Channel::PartUser(User *user, std::string &reason) this->DelUser(user); } -void Channel::KickUser(User *src, User *user, const std::string& reason) +void Channel::KickUser(User* src, User* victim, const std::string& reason) { - Membership* memb = GetUser(user); - if (IS_LOCAL(src)) + Membership* memb = GetUser(victim); + if (!memb) { - if (!memb) - { - src->WriteNumeric(ERR_USERNOTINCHANNEL, "%s %s %s :They are not on that channel",src->nick.c_str(), user->nick.c_str(), this->name.c_str()); - return; - } - if ((ServerInstance->ULine(user->server)) && (!ServerInstance->ULine(src->server))) - { - src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only a u-line may kick a u-line from a channel.",src->nick.c_str(), this->name.c_str()); - return; - } + src->WriteNumeric(ERR_USERNOTINCHANNEL, "%s %s %s :They are not on that channel",src->nick.c_str(), victim->nick.c_str(), this->name.c_str()); + return; + } + if (IS_LOCAL(src)) + { ModResult res; - if (ServerInstance->ULine(src->server)) - res = MOD_RES_ALLOW; - else - FIRST_MOD_RESULT(OnUserPreKick, res, (src,memb,reason)); - + FIRST_MOD_RESULT(OnUserPreKick, res, (src,memb,reason)); if (res == MOD_RES_DENY) return; @@ -547,18 +538,13 @@ void Channel::KickUser(User *src, User *user, const std::string& reason) } } - if (memb) - { - CUList except_list; - FOREACH_MOD(I_OnUserKick,OnUserKick(src, memb, reason, except_list)); - - WriteAllExcept(src, false, 0, except_list, "KICK %s %s :%s", name.c_str(), user->nick.c_str(), reason.c_str()); + CUList except_list; + FOREACH_MOD(I_OnUserKick,OnUserKick(src, memb, reason, except_list)); - user->chans.erase(this); - this->RemoveAllPrefixes(user); - } + WriteAllExcept(src, false, 0, except_list, "KICK %s %s :%s", name.c_str(), victim->nick.c_str(), reason.c_str()); - this->DelUser(user); + victim->chans.erase(this); + this->DelUser(victim); } void Channel::WriteChannel(User* user, const char* text, ...) |