]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/mode.cpp
Add s2s backward compatability for protocol changes
[user/henk/code/inspircd.git] / src / mode.cpp
index 38f7835fccbd5de48ae08df89fb6782cc687e419..47d59d85ae314c27e180c83e2eaa1b60eae90e15 100644 (file)
@@ -319,12 +319,6 @@ void ModeParser::DisplayCurrentModes(User *user, User* targetuser, Channel* targ
        }
        else
        {
-               if (targetuser->Visibility && !targetuser->Visibility->VisibleTo(user))
-               {
-                       user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), text);
-                       return;
-               }
-
                if (targetuser == user || user->HasPrivPermission("users/auspex"))
                {
                        /* Display user's current mode string */
@@ -335,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;
                }
        }
@@ -485,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);