]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Allow eline/gline/kline/zline by nick
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 10 Nov 2007 15:43:20 +0000 (15:43 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 10 Nov 2007 15:43:20 +0000 (15:43 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8553 e03df62e-2008-0410-955e-edbf42e46eb7

src/commands/cmd_eline.cpp
src/commands/cmd_gline.cpp
src/commands/cmd_kline.cpp
src/commands/cmd_zline.cpp

index 83c921d8bc3e0cbedb3b4e9ffaaa0a77198529ca..8d1951b3c3fa853a992815a0ca96e4f4031f7b08 100644 (file)
@@ -6,7 +6,7 @@
  * 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.
  *
  * ---------------------------------------------------
  */
@@ -26,7 +26,16 @@ CmdResult CommandEline::Handle (const char** parameters, int pcnt, User *user)
 {
        if (pcnt >= 3)
        {
-               IdentHostPair ih = ServerInstance->XLines->IdentSplit(parameters[0]);
+               IdentHostPair ih;
+               User* find = ServerInstance->FindNick(parameters[0]);
+               if (find)
+               {
+                       ih.first = "*";
+                       ih.second = find->GetIPString();
+               }
+               else
+                       ih = ServerInstance->XLines->IdentSplit(parameters[0]);
+
                if (ServerInstance->HostMatchesEveryone(ih.first+"@"+ih.second,user))
                        return CMD_FAILURE;
 
index caed54ebe6eab1eec9b5aecfe486729d8b9334ed..13d01408449466145cb7e1c6079ad8ebd0f903f7 100644 (file)
@@ -6,7 +6,7 @@
  * 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.
  *
  * ---------------------------------------------------
  */
@@ -26,7 +26,16 @@ CmdResult CommandGline::Handle (const char** parameters, int pcnt, User *user)
 {
        if (pcnt >= 3)
        {
-               IdentHostPair ih = ServerInstance->XLines->IdentSplit(parameters[0]);
+               IdentHostPair ih;
+               User* find = ServerInstance->FindNick(parameters[0]);
+               if (find)
+               {
+                       ih.first = "*";
+                       ih.second = find->GetIPString();
+               }
+               else
+                       ih = ServerInstance->XLines->IdentSplit(parameters[0]);
+
                if (ServerInstance->HostMatchesEveryone(ih.first+"@"+ih.second,user))
                        return CMD_FAILURE;
 
index 7058de77f39b7d22c2a518485e16755963e74582..49880fceb839f415de7636864111bc4f3e6f0b41 100644 (file)
@@ -6,7 +6,7 @@
  * 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.
  *
  * ---------------------------------------------------
  */
@@ -26,7 +26,16 @@ CmdResult CommandKline::Handle (const char** parameters, int pcnt, User *user)
 {
        if (pcnt >= 3)
        {
-               IdentHostPair ih = ServerInstance->XLines->IdentSplit(parameters[0]);
+               IdentHostPair ih;
+               User* find = ServerInstance->FindNick(parameters[0]);
+               if (find)
+               {
+                       ih.first = "*";
+                       ih.second = find->GetIPString();
+               }
+               else
+                       ih = ServerInstance->XLines->IdentSplit(parameters[0]);
+
                if (ServerInstance->HostMatchesEveryone(ih.first+"@"+ih.second,user))
                        return CMD_FAILURE;
 
index 520bea30653de9b1c637b919cee27139062a9412..1b765bbb4c107626ed059e5c18e2be62125e4e8b 100644 (file)
@@ -6,7 +6,7 @@
  * 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.
  *
  * ---------------------------------------------------
  */
@@ -37,12 +37,21 @@ CmdResult CommandZline::Handle (const char** parameters, int pcnt, User *user)
 
                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)
+               {
+                       ipaddr = find->GetIPString();
+               }
+               else
                {
-                       while (*ipaddr != '@')
+                       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))