]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_zline.cpp
Patch to not increment nickchange counter for nick changes that would be blocked...
[user/henk/code/inspircd.git] / src / commands / cmd_zline.cpp
index b0df24a9526af63118541653298c7bbd9b30ea2a..93ad7f8936bcfe4d0ee59dfa06ebb736a15f1fc9 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *         the file COPYING for details.
@@ -41,38 +41,31 @@ CmdResult CommandZline::Handle (const std::vector<std::string>& parameters, User
                        target = u->GetIPString();
                }
 
-               if (ServerInstance->IPMatchesEveryone(target.c_str(),user))
-                       return CMD_FAILURE;
-
-               long duration = ServerInstance->Duration(parameters[1].c_str());
-
                const char* ipaddr = target.c_str();
-               User* find = ServerInstance->FindNick(target.c_str());
 
-               if (find)
-               {
-                       ipaddr = find->GetIPString();
-               }
-               else
+               if (strchr(ipaddr,'@'))
                {
-                       if (strchr(ipaddr,'@'))
-                       {
-                               while (*ipaddr != '@')
-                                       ipaddr++;
+                       while (*ipaddr != '@')
                                ipaddr++;
-                       }
+                       ipaddr++;
                }
+
+               if (ServerInstance->IPMatchesEveryone(ipaddr,user))
+                       return CMD_FAILURE;
+
+               long duration = ServerInstance->Duration(parameters[1].c_str());
+
                ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ipaddr);
                if (ServerInstance->XLines->AddLine(zl,user))
                {
                        if (!duration)
                        {
-                               ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Z-line for %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str());
+                               ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Z-line for %s: %s", user->nick.c_str(), ipaddr, parameters[2].c_str());
                        }
                        else
                        {
                                time_t c_requires_crap = duration + ServerInstance->Time();
-                               ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Z-line for %s, expires on %s: %s",user->nick.c_str(),target.c_str(),
+                               ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Z-line for %s, expires on %s: %s",user->nick.c_str(),ipaddr,
                                                ServerInstance->TimeString(c_requires_crap).c_str(), parameters[2].c_str());
                        }
                        ServerInstance->XLines->ApplyLines();
@@ -80,7 +73,7 @@ CmdResult CommandZline::Handle (const std::vector<std::string>& parameters, User
                else
                {
                        delete zl;
-                       user->WriteServ("NOTICE %s :*** Z-Line for %s already exists",user->nick.c_str(),target.c_str());
+                       user->WriteServ("NOTICE %s :*** Z-Line for %s already exists",user->nick.c_str(),ipaddr);
                }
        }
        else