diff options
author | Daniel De Graaf <danieldg@inspircd.org> | 2010-08-04 21:27:21 -0400 |
---|---|---|
committer | Daniel De Graaf <danieldg@inspircd.org> | 2010-08-04 21:27:21 -0400 |
commit | 460453230db00a2e779259c94be1bedc57c43aec (patch) | |
tree | 35738898bda4e53bb3623ae00b4c84f24da17db0 | |
parent | a8bc3d7645114789c1dff49e6819981cba704435 (diff) |
Prevent kicking people you do not have permission to deprivilege
-rw-r--r-- | src/channels.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 0ad99fb94..01450ce61 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -526,10 +526,13 @@ void Channel::KickUser(User *src, User *user, const char* reason) if (res == MOD_RES_PASSTHRU) { int them = this->GetPrefixValue(src); - int us = this->GetPrefixValue(user); - if ((them < HALFOP_VALUE) || (them < us)) + char us = GetPrefixChar(user)[0]; + ModeHandler* mh = ServerInstance->Modes->FindMode(us, MODETYPE_CHANNEL); + int min = mh ? mh->GetLevelRequired() : HALFOP_VALUE; + if (them < HALFOP_VALUE || them < min) { - src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator",src->nick.c_str(), this->name.c_str(), them >= HALFOP_VALUE ? "" : "half-"); + src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator", + src->nick.c_str(), this->name.c_str(), min > HALFOP_VALUE ? "" : "half-"); return; } } |