summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel De Graaf <danieldg@inspircd.org>2010-09-30 19:03:06 -0400
committerDaniel De Graaf <danieldg@inspircd.org>2010-09-30 19:03:06 -0400
commit4fb31d6a3494a99819225fe36da75c5991461dc6 (patch)
treec39e8af80c179279e61cf0897bc78ec50a68adf2
parent3dc56e3425c0cc41caee9ac33c60204cb8cbf8c9 (diff)
Fix kick level check to scan all status modes and not skip checks for modeless users
-rw-r--r--src/channels.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index 5779fb50b..8e7d4af06 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -523,16 +523,21 @@ void Channel::KickUser(User *src, User *user, const char* reason)
if (res == MOD_RES_DENY)
return;
- if (res == MOD_RES_PASSTHRU && !memb->modes.empty())
+ if (res == MOD_RES_PASSTHRU)
{
- int them = this->GetPrefixValue(src);
- char us = memb->modes[0];
- ModeHandler* mh = ServerInstance->Modes->FindMode(us, MODETYPE_CHANNEL);
- int min = mh ? mh->GetLevelRequired() : HALFOP_VALUE;
- if (them < HALFOP_VALUE || them < min)
+ unsigned int them = this->GetPrefixValue(src);
+ unsigned int req = HALFOP_VALUE;
+ for (std::string::size_type i = 0; i < memb->modes.length(); i++)
+ {
+ ModeHandler* mh = ServerInstance->Modes->FindMode(memb->modes[i], MODETYPE_CHANNEL);
+ if (mh && mh->GetLevelRequired() > req)
+ req = mh->GetLevelRequired();
+ }
+
+ if (them < req)
{
src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator",
- src->nick.c_str(), this->name.c_str(), min > HALFOP_VALUE ? "" : "half-");
+ src->nick.c_str(), this->name.c_str(), req > HALFOP_VALUE ? "" : "half-");
return;
}
}