]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nicklock.cpp
Resolve /STATS S conflict between SVSHOLD and SHUN
[user/henk/code/inspircd.git] / src / modules / m_nicklock.cpp
index bfbda003ff0a291ecb129d3d1ccaea5972acbd1d..0ba90e9847ca3e54818fd0022e53d912b4f1f53f 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -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;
                        }
                }
@@ -166,18 +152,14 @@ class ModuleNickLock : public Module
 
        Version GetVersion()
        {
-               return Version("Provides the NICKLOCK command, allows an oper to chage a users nick and lock them to it until they quit", VF_COMMON | VF_VENDOR, API_VERSION);
+               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))
                        return MOD_RES_PASSTHRU;
 
-               if (isdigit(newnick[0])) /* Allow a switch to a UID */
-                       return MOD_RES_PASSTHRU;
-
                if (ServerInstance->NICKForced.get(user)) /* Allow forced nick changes */
                        return MOD_RES_PASSTHRU;