1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 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 * ---------------------------------------------------
15 #include "commands/cmd_kick.h"
17 extern "C" DllExport Command* init_command(InspIRCd* Instance)
19 return new CommandKick(Instance);
24 CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User *user)
27 Channel* c = ServerInstance->FindChan(parameters[0]);
28 User* u = ServerInstance->FindNick(parameters[1]);
30 if (ServerInstance->Parser->LoopCall(user, this, parameters, 1))
35 user->WriteServ( "401 %s %s :No such nick/channel", user->nick.c_str(), u ? parameters[0].c_str() : parameters[1].c_str());
39 if ((IS_LOCAL(user)) && (!c->HasUser(user)) && (!ServerInstance->ULine(user->server)))
41 user->WriteServ( "442 %s %s :You're not on that channel!", user->nick.c_str(), parameters[0].c_str());
45 if (parameters.size() > 2)
47 reason.assign(parameters[2], 0, ServerInstance->Config->Limits.MaxKick);
51 reason.assign(user->nick, 0, ServerInstance->Config->Limits.MaxKick);
54 if (!c->KickUser(user, u, reason.c_str()))
55 /* Nobody left here, delete the Channel */