]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix NICKLOCK/SANICK errors with Q:lined nicks
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 5 Feb 2010 15:59:06 +0000 (15:59 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 5 Feb 2010 15:59:06 +0000 (15:59 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12378 e03df62e-2008-0410-955e-edbf42e46eb7

src/modules/m_nicklock.cpp
src/users.cpp

index dd65a5a74e2e587141706f0c416d587fa2db6aaf..0ba90e9847ca3e54818fd0022e53d912b4f1f53f 100644 (file)
@@ -33,21 +33,15 @@ class CommandNicklock : public Command
        {
                User* target = ServerInstance->FindNick(parameters[0]);
 
+               if (!target)
+               {
+                       user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick.c_str(), parameters[0].c_str());
+                       return CMD_FAILURE;
+               }
+
                /* Do local sanity checks and bails */
                if (IS_LOCAL(user))
                {
-                       if (target && ServerInstance->ULine(target->server))
-                       {
-                               user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an NICKLOCK command on a u-lined client",user->nick.c_str());
-                               return CMD_FAILURE;
-                       }
-
-                       if (!target)
-                       {
-                               user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick.c_str(), parameters[0].c_str());
-                               return CMD_FAILURE;
-                       }
-
                        if (!ServerInstance->IsNick(parameters[1].c_str(), ServerInstance->Config->Limits.NickMax))
                        {
                                user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick.c_str(), parameters[1].c_str());
@@ -58,7 +52,7 @@ class CommandNicklock : public Command
                }
 
                /* If we made it this far, extend the user */
-               if (target && IS_LOCAL(target))
+               if (IS_LOCAL(target))
                {
                        locked.set(target, 1);
 
@@ -102,32 +96,24 @@ class CommandNickunlock : public Command
        {
                User* target = ServerInstance->FindNick(parameters[0]);
 
-               /* Do local sanity checks and bails */
-               if (IS_LOCAL(user))
+               if (!target)
                {
-                       if (target && ServerInstance->ULine(target->server))
-                       {
-                               user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an NICKUNLOCK command on a u-lined client",user->nick.c_str());
-                               return CMD_FAILURE;
-                       }
-
-                       if (!target)
-                       {
-                               user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick.c_str(), parameters[0].c_str());
-                               return CMD_FAILURE;
-                       }
+                       user->WriteServ("NOTICE %s :*** No such nickname: '%s'", user->nick.c_str(), parameters[0].c_str());
+                       return CMD_FAILURE;
                }
 
-               if (target && IS_LOCAL(target))
+               if (IS_LOCAL(target))
                {
                        if (locked.set(target, 0))
                        {
-                               ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick)+" used NICKUNLOCK on "+parameters[0]);
-                               user->WriteNumeric(945, "%s %s :Nickname now unlocked.",user->nick.c_str(),target->nick.c_str());
+                               ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used NICKUNLOCK on "+target->nick);
+                               user->SendText(":%s 945 %s %s :Nickname now unlocked.",
+                                       ServerInstance->Config->ServerName.c_str(),user->nick.c_str(),target->nick.c_str());
                        }
                        else
                        {
-                               user->WriteNumeric(946, "%s %s :This user's nickname is not locked.",user->nick.c_str(),target->nick.c_str());
+                               user->SendText(":%s 946 %s %s :This user's nickname is not locked.",
+                                       ServerInstance->Config->ServerName.c_str(),user->nick.c_str(),target->nick.c_str());
                                return CMD_FAILURE;
                        }
                }
@@ -169,7 +155,6 @@ class ModuleNickLock : public Module
                return Version("Provides the NICKLOCK command, allows an oper to chage a users nick and lock them to it until they quit", VF_OPTCOMMON | VF_VENDOR);
        }
 
-
        ModResult OnUserPreNick(User* user, const std::string &newnick)
        {
                if (!IS_LOCAL(user))
index 1392af0755af7ea1c41f122346bc445505ad9d7f..c01b5d1b274dcf12c4a118999d69fd4d2250aafe 100644 (file)
@@ -904,7 +904,7 @@ bool User::ChangeNick(const std::string& newnick, bool force)
                 * Also don't check Q:Lines for remote nickchanges, they should have our Q:Lines anyway to enforce themselves.
                 *              -- w00t
                 */
-               if (!IS_LOCAL(this))
+               if (IS_LOCAL(this))
                {
                        XLine* mq = ServerInstance->XLines->MatchesLine("Q",newnick);
                        if (mq)