1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
15 #include "configreader.h"
19 #include "commands/cmd_qline.h"
23 extern "C" DllExport command_t* init_command(InspIRCd* Instance)
25 return new cmd_qline(Instance);
28 CmdResult cmd_qline::Handle (const char** parameters, int pcnt, userrec *user)
32 if (ServerInstance->NickMatchesEveryone(parameters[0],user))
35 if (strchr(parameters[0],'@') || strchr(parameters[0],'!') || strchr(parameters[0],'.'))
37 user->WriteServ("NOTICE %s :*** A Q-Line only bans a nick pattern, not a nick!user@host pattern.",user->nick);
41 long duration = ServerInstance->Duration(parameters[1]);
42 if (ServerInstance->XLines->add_qline(duration,user->nick,parameters[2],parameters[0]))
44 int to_apply = APPLY_QLINES;
45 FOREACH_MOD(I_OnAddQLine,OnAddQLine(duration, user, parameters[2], parameters[0]));
48 to_apply |= APPLY_PERM_ONLY;
49 ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Q-line for %s.",user->nick,parameters[0]);
53 time_t c_requires_crap = duration + ServerInstance->Time();
54 ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Q-line for %s, expires on %s",user->nick,parameters[0],
55 ServerInstance->TimeString(c_requires_crap).c_str());
57 ServerInstance->XLines->apply_lines(to_apply);
62 if (ServerInstance->XLines->del_qline(parameters[0]))
64 FOREACH_MOD(I_OnDelQLine,OnDelQLine(user, parameters[0]));
65 ServerInstance->SNO->WriteToSnoMask('x',"%s Removed Q-line on %s.",user->nick,parameters[0]);
69 user->WriteServ("NOTICE %s :*** Q-Line %s not found in list, try /stats q.",user->nick,parameters[0]);