1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 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 /** Handle /KICK. These command handlers can be reloaded by the core,
17 * and handle basic RFC1459 commands. Commands within modules work
18 * the same way, however, they can be fully unloaded, where these
21 class CommandKick : public Command
24 /** Constructor for kick.
26 CommandKick ( Module* parent) : Command(parent,"KICK",2,3) { syntax = "<channel> <nick>{,<nick>} [<reason>]"; }
28 * @param parameters The parameters to the comamnd
29 * @param pcnt The number of parameters passed to teh command
30 * @param user The user issuing the command
31 * @return A value from CmdResult to indicate command success or failure.
33 CmdResult Handle(const std::vector<std::string>& parameters, User *user);
39 CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User *user)
42 Channel* c = ServerInstance->FindChan(parameters[0]);
43 User* u = ServerInstance->FindNick(parameters[1]);
45 if (ServerInstance->Parser->LoopCall(user, this, parameters, 1))
50 user->WriteServ( "401 %s %s :No such nick/channel", user->nick.c_str(), u ? parameters[0].c_str() : parameters[1].c_str());
54 if ((IS_LOCAL(user)) && (!c->HasUser(user)) && (!ServerInstance->ULine(user->server)))
56 user->WriteServ( "442 %s %s :You're not on that channel!", user->nick.c_str(), parameters[0].c_str());
60 if (parameters.size() > 2)
62 reason.assign(parameters[2], 0, ServerInstance->Config->Limits.MaxKick);
66 reason.assign(user->nick, 0, ServerInstance->Config->Limits.MaxKick);
69 c->KickUser(user, u, reason.c_str());
74 COMMAND_INIT(CommandKick)