diff options
Diffstat (limited to 'src/mode.cpp')
-rw-r--r-- | src/mode.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/mode.cpp b/src/mode.cpp index 22b1e261f..47d59d85a 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -329,7 +329,7 @@ void ModeParser::DisplayCurrentModes(User *user, User* targetuser, Channel* targ } else { - user->WriteNumeric(ERR_USERSDONTMATCH, "%s :Can't change mode for other users", user->nick.c_str()); + user->WriteNumeric(ERR_USERSDONTMATCH, "%s :Can't view modes for other users", user->nick.c_str()); return; } } @@ -479,27 +479,26 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user, { SkipAccessChecks = true; } - else if (targetchannel) + else { /* Overall access control hook for mode change */ + int hook = targetchannel ? AC_GENERAL_MODE : AC_GENERAL_UMODE; + LastParse = mode_sequence; ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnAccessCheck, MOD_RESULT, (user, NULL, targetchannel, AC_GENERAL_MODE)); + FIRST_MOD_RESULT(ServerInstance, OnAccessCheck, MOD_RESULT, (user, targetuser, targetchannel, hook)); LastParse.clear(); if (MOD_RESULT == MOD_RES_DENY) return; SkipAccessChecks = (MOD_RESULT == MOD_RES_ALLOW); } - else + + if (targetuser && !SkipAccessChecks && user != targetuser) { - if (user != targetuser) - { - user->WriteNumeric(ERR_USERSDONTMATCH, "%s :Can't change mode for other users", user->nick.c_str()); - return; - } + user->WriteNumeric(ERR_USERSDONTMATCH, "%s :Can't change mode for other users", user->nick.c_str()); + return; } - std::string output_mode; std::ostringstream output_parameters; LastParseParams.push_back(output_mode); |