2005-12-16 18:10:38 +00:00
|
|
|
/* +------------------------------------+
|
|
|
|
* | Inspire Internet Relay Chat Daemon |
|
|
|
|
* +------------------------------------+
|
|
|
|
*
|
2006-01-15 15:59:11 +00:00
|
|
|
* InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
|
2005-12-16 18:10:38 +00:00
|
|
|
* E-mail:
|
2006-01-15 15:59:11 +00:00
|
|
|
* <brain@chatspike.net>
|
|
|
|
* <Craig@chatspike.net>
|
2005-12-16 18:10:38 +00:00
|
|
|
*
|
|
|
|
* Written by Craig Edwards, Craig McLure, and others.
|
|
|
|
* This program is free but copyrighted software; see
|
|
|
|
* the file COPYING for details.
|
|
|
|
*
|
|
|
|
* ---------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "inspircd_config.h"
|
|
|
|
#include "inspircd.h"
|
2006-04-08 17:05:48 +00:00
|
|
|
#include "configreader.h"
|
2005-12-16 18:10:38 +00:00
|
|
|
#include "users.h"
|
|
|
|
#include "modules.h"
|
|
|
|
#include "commands.h"
|
|
|
|
#include "xline.h"
|
|
|
|
#include "helperfuncs.h"
|
2006-04-20 18:55:46 +00:00
|
|
|
#include "commands/cmd_zline.h"
|
2005-12-16 18:10:38 +00:00
|
|
|
|
2006-08-11 01:35:01 +00:00
|
|
|
|
2005-12-16 18:10:38 +00:00
|
|
|
|
2006-07-16 12:18:29 +00:00
|
|
|
void cmd_zline::Handle (const char** parameters, int pcnt, userrec *user)
|
2005-12-16 18:10:38 +00:00
|
|
|
{
|
|
|
|
if (pcnt >= 3)
|
|
|
|
{
|
|
|
|
if (strchr(parameters[0],'@'))
|
|
|
|
{
|
2006-08-08 18:59:13 +00:00
|
|
|
user->WriteServ("NOTICE %s :*** You cannot include a username in a zline, a zline must ban only an IP mask",user->nick);
|
2005-12-16 18:10:38 +00:00
|
|
|
return;
|
|
|
|
}
|
2006-08-11 15:14:39 +00:00
|
|
|
if (ServerInstance->ip_matches_everyone(parameters[0],user))
|
2005-12-16 18:10:38 +00:00
|
|
|
return;
|
2006-08-11 15:14:39 +00:00
|
|
|
ServerInstance->XLines->add_zline(ServerInstance->duration(parameters[1]),user->nick,parameters[2],parameters[0]);
|
|
|
|
FOREACH_MOD(I_OnAddZLine,OnAddZLine(ServerInstance->duration(parameters[1]), user, parameters[2], parameters[0]));
|
|
|
|
if (!ServerInstance->duration(parameters[1]))
|
2005-12-16 18:10:38 +00:00
|
|
|
{
|
2006-08-10 14:43:29 +00:00
|
|
|
ServerInstance->WriteOpers("*** %s added permanent Z-line for %s.",user->nick,parameters[0]);
|
2005-12-16 18:10:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-11 15:14:39 +00:00
|
|
|
ServerInstance->WriteOpers("*** %s added timed Z-line for %s, expires in %d seconds.",user->nick,parameters[0],ServerInstance->duration(parameters[1]));
|
2005-12-16 18:10:38 +00:00
|
|
|
}
|
2006-08-11 11:06:40 +00:00
|
|
|
ServerInstance->XLines->apply_lines(APPLY_ZLINES);
|
2005-12-16 18:10:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-11 11:06:40 +00:00
|
|
|
if (ServerInstance->XLines->del_zline(parameters[0]))
|
2005-12-16 18:10:38 +00:00
|
|
|
{
|
2005-12-26 17:26:16 +00:00
|
|
|
FOREACH_MOD(I_OnDelZLine,OnDelZLine(user, parameters[0]));
|
2006-08-10 14:43:29 +00:00
|
|
|
ServerInstance->WriteOpers("*** %s Removed Z-line on %s.",user->nick,parameters[0]);
|
2005-12-16 18:10:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-08 18:59:13 +00:00
|
|
|
user->WriteServ("NOTICE %s :*** Z-Line %s not found in list, try /stats Z.",user->nick,parameters[0]);
|
2005-12-16 18:10:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|