1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
16 #ifndef __CMD_KICK_H__
17 #define __CMD_KICK_H__
19 // include the common header files
24 /** Handle /KICK. These command handlers can be reloaded by the core,
25 * and handle basic RFC1459 commands. Commands within modules work
26 * the same way, however, they can be fully unloaded, where these
29 class CommandKick : public Command
32 /** Constructor for kick.
34 CommandKick ( Module* parent) : Command(parent,"KICK",2,3) { syntax = "<channel> <nick>{,<nick>} [<reason>]"; }
36 * @param parameters The parameters to the comamnd
37 * @param pcnt The number of parameters passed to teh command
38 * @param user The user issuing the command
39 * @return A value from CmdResult to indicate command success or failure.
41 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
49 CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User *user)
52 Channel* c = ServerInstance->FindChan(parameters[0]);
53 User* u = ServerInstance->FindNick(parameters[1]);
55 if (ServerInstance->Parser->LoopCall(user, this, parameters, 1))
60 user->WriteServ( "401 %s %s :No such nick/channel", user->nick.c_str(), u ? parameters[0].c_str() : parameters[1].c_str());
64 if ((IS_LOCAL(user)) && (!c->HasUser(user)) && (!ServerInstance->ULine(user->server)))
66 user->WriteServ( "442 %s %s :You're not on that channel!", user->nick.c_str(), parameters[0].c_str());
70 if (parameters.size() > 2)
72 reason.assign(parameters[2], 0, ServerInstance->Config->Limits.MaxKick);
76 reason.assign(user->nick, 0, ServerInstance->Config->Limits.MaxKick);
79 if (!c->KickUser(user, u, reason.c_str()))
80 /* Nobody left here, delete the Channel */
86 COMMAND_INIT(CommandKick)