summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-10 15:43:20 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-11-10 15:43:20 +0000
commit945a5587598a3ceb86d83b3ab3c154691995acba (patch)
tree25ace6a4eb85b7eba44c331e0acfeeb51f5489c0 /src
parentb94c45340e153254f9dd06ecc3445222f31d0220 (diff)
Allow eline/gline/kline/zline by nick
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8553 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/commands/cmd_eline.cpp13
-rw-r--r--src/commands/cmd_gline.cpp13
-rw-r--r--src/commands/cmd_kline.cpp13
-rw-r--r--src/commands/cmd_zline.cpp19
4 files changed, 47 insertions, 11 deletions
diff --git a/src/commands/cmd_eline.cpp b/src/commands/cmd_eline.cpp
index 83c921d8b..8d1951b3c 100644
--- a/src/commands/cmd_eline.cpp
+++ b/src/commands/cmd_eline.cpp
@@ -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;
diff --git a/src/commands/cmd_gline.cpp b/src/commands/cmd_gline.cpp
index caed54ebe..13d014084 100644
--- a/src/commands/cmd_gline.cpp
+++ b/src/commands/cmd_gline.cpp
@@ -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;
diff --git a/src/commands/cmd_kline.cpp b/src/commands/cmd_kline.cpp
index 7058de77f..49880fceb 100644
--- a/src/commands/cmd_kline.cpp
+++ b/src/commands/cmd_kline.cpp
@@ -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;
diff --git a/src/commands/cmd_zline.cpp b/src/commands/cmd_zline.cpp
index 520bea306..1b765bbb4 100644
--- a/src/commands/cmd_zline.cpp
+++ b/src/commands/cmd_zline.cpp
@@ -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))