aboutsummaryrefslogtreecommitdiffstats
path: root/src/mode.cpp
diff options
context:
space:
mode:
authorGravatar Daniel De Graaf2010-02-20 01:00:59 -0600
committerGravatar Daniel De Graaf2010-08-03 17:32:36 -0400
commit31092b3ef004010d28bcf4d7fe1a598b07e3b2f5 (patch)
tree2e5af5398846b4c6ff409c886df1db89d0b88566 /src/mode.cpp
parentAdd <options:nameonlymodes> (diff)
m_modeaccess, channel mode +W, allows the prefix required to set a mode to be changed
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp33
1 files changed, 2 insertions, 31 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 9c5f8ce36..666eee0a9 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -351,39 +351,10 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, irc:
{
MOD_RESULT = mh->AccessCheck(user, chan, mc.value, adding);
+ if (MOD_RESULT == MOD_RES_PASSTHRU)
+ MOD_RESULT = ServerInstance->ModeAccessCheck(user, chan, mc);
if (MOD_RESULT == MOD_RES_DENY)
return MODEACTION_DENY;
- if (MOD_RESULT == MOD_RES_PASSTHRU)
- {
- unsigned int neededrank = mh->GetLevelRequired();
- /* Compare our rank on the channel against the rank of the required prefix,
- * allow if >= ours. Because mIRC and xchat throw a tizz if the modes shown
- * in NAMES(X) are not in rank order, we know the most powerful mode is listed
- * first, so we don't need to iterate, we just look up the first instead.
- */
- unsigned int ourrank = chan->GetPrefixValue(user);
- if (ourrank < neededrank)
- {
- ModeHandler* neededmh = NULL;
- for(ModeIDIter id; id; id++)
- {
- ModeHandler* privmh = FindMode(id);
- if (privmh && privmh->GetPrefixRank() >= neededrank)
- {
- // this mode is sufficient to allow this action
- if (!neededmh || privmh->GetPrefixRank() < neededmh->GetPrefixRank())
- neededmh = privmh;
- }
- }
- if (neededmh)
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must have channel %s access or above to %sset the %s channel mode",
- user->nick.c_str(), chan->name.c_str(), neededmh->name.c_str(), adding ? "" : "un", mh->name.c_str());
- else
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You cannot %sset the %s channel mode",
- user->nick.c_str(), chan->name.c_str(), adding ? "" : "un", mh->name.c_str());
- return MODEACTION_DENY;
- }
- }
}
std::pair<ModeWatcherMap::iterator,ModeWatcherMap::iterator> watchers = modewatchers.equal_range(modeid);