]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_kick.cpp
Tidying, strlen, strcasecmp where not needed.
[user/henk/code/inspircd.git] / src / cmd_kick.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 using namespace std;
18
19 #include "inspircd_config.h"
20 #include "inspircd.h"
21 #include "inspircd_io.h"
22 #include <time.h>
23 #include <string>
24 #include <sstream>
25 #include <vector>
26 #include <deque>
27 #include "users.h"
28 #include "ctables.h"
29 #include "globals.h"
30 #include "modules.h"
31 #include "dynamic.h"
32 #include "wildcard.h"
33 #include "message.h"
34 #include "commands.h"
35 #include "inspstring.h"
36 #include "helperfuncs.h"
37 #include "hashcomp.h"
38 #include "typedefs.h"
39 #include "command_parse.h"
40 #include "cmd_kick.h"
41
42 void cmd_kick::Handle (char **parameters, int pcnt, userrec *user)
43 {
44         char reason[MAXKICK];
45         
46         chanrec* Ptr = FindChan(parameters[0]);
47         userrec* u   = Find(parameters[1]);
48
49         if (!u || !Ptr)
50         {
51                 WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, u ? parameters[0] : parameters[1]);
52                 return;
53         }
54         if ((IS_LOCAL(user)) && (!has_channel(user,Ptr)) && (!is_uline(user->server)))
55         {
56                 WriteServ(user->fd,"442 %s %s :You're not on that channel!",user->nick, parameters[0]);
57                 return;
58         }
59
60         if (pcnt > 2)
61         {
62                 strlcpy(reason,parameters[2],MAXKICK-1);
63                 kick_channel(user,u,Ptr,reason);
64         }
65         else
66         {
67                 strlcpy(reason,user->nick,MAXKICK-1);
68                 kick_channel(user,u,Ptr,reason);
69         }
70 }
71
72