]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Prevent kicking people you do not have permission to deprivilege
authorDaniel De Graaf <danieldg@inspircd.org>
Thu, 5 Aug 2010 01:27:21 +0000 (21:27 -0400)
committerDaniel De Graaf <danieldg@inspircd.org>
Thu, 5 Aug 2010 01:27:21 +0000 (21:27 -0400)
src/channels.cpp

index 0ad99fb94d3946778a487fdf0439551c4e86a243..01450ce61a478082d65d9ad25bda519828f0c14f 100644 (file)
@@ -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;
                        }
                }