/*
* InspIRCd -- Internet Relay Chat Daemon
*
- * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ * Copyright (C) 2017-2018 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2017 B00mX0r <b00mx0r@aureus.pw>
+ * Copyright (C) 2013-2014, 2016 Attila Molnar <attilamolnar@hush.com>
+ * Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
+ * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
+ * Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
+ * Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
+ * Copyright (C) 2007-2008 Dennis Friis <peavey@inspircd.org>
* Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
+ * Copyright (C) 2006 Craig Edwards <brain@inspircd.org>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
CommandKick::CommandKick(Module* parent)
: Command(parent, "KICK", 2, 3)
{
- syntax = "<channel> <nick>{,<nick>} [<reason>]";
+ syntax = "<channel> <nick>[,<nick>]+ [:<reason>]";
}
/** Handle /KICK
*/
-CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User *user)
+CmdResult CommandKick::Handle(User* user, const Params& parameters)
{
Channel* c = ServerInstance->FindChan(parameters[0]);
User* u;
else
u = ServerInstance->FindNick(parameters[1]);
- if ((!u) || (!c) || (u->registered != REG_ALL))
+ if (!c)
{
- user->WriteNumeric(Numerics::NoSuchNick(c ? parameters[1] : parameters[0]));
+ user->WriteNumeric(Numerics::NoSuchChannel(parameters[0]));
+ return CMD_FAILURE;
+ }
+ if ((!u) || (u->registered != REG_ALL))
+ {
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[1]));
return CMD_FAILURE;
}
if (u->server->IsULine())
{
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, c->name, "You may not kick a u-lined client");
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, c->name, "You may not kick a U-lined client");
return CMD_FAILURE;
}
}
for (std::string::size_type i = 0; i < memb->modes.length(); i++)
{
ModeHandler* mh = ServerInstance->Modes->FindMode(memb->modes[i], MODETYPE_CHANNEL);
- if (mh && mh->GetLevelRequired() > req)
- req = mh->GetLevelRequired();
+ if (mh && mh->GetLevelRequired(true) > req)
+ req = mh->GetLevelRequired(true);
}
if (them < req)
return CMD_SUCCESS;
}
-RouteDescriptor CommandKick::GetRouting(User* user, const std::vector<std::string>& parameters)
+RouteDescriptor CommandKick::GetRouting(User* user, const Params& parameters)
{
return (IS_LOCAL(user) ? ROUTE_LOCALONLY : ROUTE_BROADCAST);
}