2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2013, 2018 Sadie Powell <sadie@witchery.services>
5 * Copyright (C) 2012-2014, 2016 Attila Molnar <attilamolnar@hush.com>
6 * Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
7 * Copyright (C) 2010 Craig Edwards <brain@inspircd.org>
8 * Copyright (C) 2009 John Brooks <special@inspircd.org>
9 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
11 * This file is part of InspIRCd. InspIRCd is free software: you can
12 * redistribute it and/or modify it under the terms of the GNU General Public
13 * License as published by the Free Software Foundation, version 2.
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29 class CommandSakick : public Command
32 CommandSakick(Module* Creator) : Command(Creator,"SAKICK", 2, 3)
34 flags_needed = 'o'; syntax = "<channel> <nick> [:<reason>]";
35 TRANSLATE3(TR_TEXT, TR_NICK, TR_TEXT);
38 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
40 User* dest = ServerInstance->FindNick(parameters[1]);
41 Channel* channel = ServerInstance->FindChan(parameters[0]);
43 if ((dest) && (dest->registered == REG_ALL) && (channel))
45 const std::string& reason = (parameters.size() > 2) ? parameters[2] : dest->nick;
47 if (dest->server->IsULine())
49 user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a U-lined client");
53 if (!channel->HasUser(dest))
55 user->WriteNotice("*** " + dest->nick + " is not on " + channel->name);
59 /* For local clients, directly kick them. For remote clients,
60 * just return CMD_SUCCESS knowing the protocol module will route the SAKICK to the user's
61 * local server and that will kick them instead.
65 // Target is on this server, kick them and send the snotice
66 channel->KickUser(ServerInstance->FakeClient, dest, reason);
67 ServerInstance->SNO->WriteGlobalSno('a', user->nick + " SAKICKed " + dest->nick + " on " + channel->name);
74 user->WriteNotice("*** Invalid nickname or channel");
80 RouteDescriptor GetRouting(User* user, const Params& parameters) CXX11_OVERRIDE
82 return ROUTE_OPT_UCAST(parameters[1]);
86 class ModuleSakick : public Module
95 Version GetVersion() CXX11_OVERRIDE
97 return Version("Provides the SAKICK command", VF_OPTCOMMON|VF_VENDOR);
101 MODULE_INIT(ModuleSakick)