diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-02-05 15:59:06 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-02-05 15:59:06 +0000 |
commit | d560adec9e578c40f786a0849e3a15f99e738b56 (patch) | |
tree | fb9fd98046a969ece8b3e8ed41774a91c477bb9e /src | |
parent | 82a3069c5604a8b815021532ebfcc98cb50c9c7d (diff) |
Fix NICKLOCK/SANICK errors with Q:lined nicks
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12378 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_nicklock.cpp | 47 | ||||
-rw-r--r-- | src/users.cpp | 2 |
2 files changed, 17 insertions, 32 deletions
diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index dd65a5a74..0ba90e984 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -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)) diff --git a/src/users.cpp b/src/users.cpp index 1392af075..c01b5d1b2 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -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) |