]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_zline.cpp
Add -Wshadow to cflags, and fix a bunch of warnings that come with it. Add a note...
[user/henk/code/inspircd.git] / src / commands / cmd_zline.cpp
index 520bea30653de9b1c637b919cee27139062a9412..a9f76a9328b286c1d6dcede0cf26411fae5d809e 100644 (file)
@@ -2,11 +2,11 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
- *            the file COPYING for details.
+ *         the file COPYING for details.
  *
  * ---------------------------------------------------
  */
@@ -32,17 +32,33 @@ CmdResult CommandZline::Handle (const char** parameters, int pcnt, User *user)
                        return CMD_FAILURE;
                }
 
+               User *u = ServerInstance->FindNick(parameters[0]);
+               
+               if (u)
+               {
+                       parameters[0] = u->GetIPString();
+               }
+
                if (ServerInstance->IPMatchesEveryone(parameters[0],user))
                        return CMD_FAILURE;
 
                long duration = ServerInstance->Duration(parameters[1]);
 
-               const char* ipaddr = parameters[0]; 
-               if (strchr(ipaddr,'@'))
+               const char* ipaddr = parameters[0];
+               User* find = ServerInstance->FindNick(parameters[0]);
+
+               if (find)
                {
-                       while (*ipaddr != '@')
+                       ipaddr = find->GetIPString();
+               }
+               else
+               {
+                       if (strchr(ipaddr,'@'))
+                       {
+                               while (*ipaddr != '@')
+                                       ipaddr++;
                                ipaddr++;
-                       ipaddr++;
+                       }
                }
                ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), duration, user->nick, parameters[2], ipaddr);
                if (ServerInstance->XLines->AddLine(zl,user))