]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_qline.cpp
3e5e9fbdf3df39c38b740ec5d8d7bcaf956fdbad
[user/henk/code/inspircd.git] / src / cmd_qline.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 #include "inspircd_config.h"
18 #include "configreader.h"
19 #include "users.h"
20 #include "modules.h"
21 #include "commands.h"
22 #include "xline.h"
23 #include "helperfuncs.h"
24 #include "commands/cmd_qline.h"
25
26 extern InspIRCd* ServerInstance;
27
28 void cmd_qline::Handle (const char** parameters, int pcnt, userrec *user)
29 {
30         if (pcnt >= 3)
31         {
32                 if (nick_matches_everyone(parameters[0],user))
33                         return;
34                 add_qline(duration(parameters[1]),user->nick,parameters[2],parameters[0]);
35                 FOREACH_MOD(I_OnAddQLine,OnAddQLine(duration(parameters[1]), user, parameters[2], parameters[0]));
36                 if (!duration(parameters[1]))
37                 {
38                         ServerInstance->WriteOpers("*** %s added permanent Q-line for %s.",user->nick,parameters[0]);
39                 }
40                 else
41                 {
42                         ServerInstance->WriteOpers("*** %s added timed Q-line for %s, expires in %d seconds.",user->nick,parameters[0],duration(parameters[1]));
43                 }
44                 apply_lines(APPLY_QLINES);
45         }
46         else
47         {
48                 if (del_qline(parameters[0]))
49                 {
50                         FOREACH_MOD(I_OnDelQLine,OnDelQLine(user, parameters[0]));
51                         ServerInstance->WriteOpers("*** %s Removed Q-line on %s.",user->nick,parameters[0]);
52                 }
53                 else
54                 {
55                         user->WriteServ("NOTICE %s :*** Q-Line %s not found in list, try /stats q.",user->nick,parameters[0]);
56                 }
57         }
58 }