diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:51:33 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:51:33 +0000 |
commit | 54e89b822e36b36eb9b080bbb4befe097471cec2 (patch) | |
tree | 8150e55f05808b4fc1b6eb77caf8b11f9786f491 /src/mode.cpp | |
parent | 0145d909d207e0117c0d10ee2195b53b4b823fb4 (diff) |
Change SAMODE to source from the acting user, not the server
This is a merge of the OOMODE command into SAMODE.
This fixes SAMODE not working because of mode merging.
An additional access check for umode changes is added for this command.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11647 e03df62e-2008-0410-955e-edbf42e46eb7
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); |