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 * ---------------------------------------------------
16 #include "commands/cmd_kick.h"
18 extern "C" command_t* init_command(InspIRCd* Instance)
20 return new cmd_kick(Instance);
25 CmdResult cmd_kick::Handle (const char** parameters, int pcnt, userrec *user)
28 chanrec* c = ServerInstance->FindChan(parameters[0]);
29 userrec* u = ServerInstance->FindNick(parameters[1]);
33 user->WriteServ( "401 %s %s :No such nick/channel", user->nick, u ? parameters[0] : parameters[1]);
37 if ((IS_LOCAL(user)) && (!c->HasUser(user)) && (!ServerInstance->ULine(user->server)))
39 user->WriteServ( "442 %s %s :You're not on that channel!", user->nick, parameters[0]);
45 strlcpy(reason, parameters[2], MAXKICK - 1);
49 strlcpy(reason, user->nick, MAXKICK - 1);
52 if (!c->KickUser(user, u, reason))
53 /* Nobody left here, delete the chanrec */