From 460453230db00a2e779259c94be1bedc57c43aec Mon Sep 17 00:00:00 2001 From: Daniel De Graaf Date: Wed, 4 Aug 2010 21:27:21 -0400 Subject: Prevent kicking people you do not have permission to deprivilege --- src/channels.cpp | 9 ++++++--- 1 file 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; } } -- cgit v1.2.3