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 /* $ModDesc: Provides a SAKICK command */
20 class CommandSakick : public Command
23 CommandSakick (InspIRCd* Instance) : Command(Instance,"SAKICK", "o", 2, 3, false, 0)
25 this->source = "m_sakick.so";
26 syntax = "<channel> <nick> [reason]";
27 TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END);
30 CmdResult Handle (const std::vector<std::string>& parameters, User *user)
32 User* dest = ServerInstance->FindNick(parameters[1]);
33 Channel* channel = ServerInstance->FindChan(parameters[0]);
34 const char* reason = "";
35 const char* servername = NULL;
39 if (parameters.size() > 2)
41 reason = parameters[2].c_str();
45 reason = dest->nick.c_str();
48 if (ServerInstance->ULine(dest->server))
50 user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str());
54 /* For local clients, directly kick them. For remote clients,
55 * just return CMD_SUCCESS knowing the protocol module will route the SAKICK to the user's
56 * local server and that will kick them instead.
60 if (!channel->ServerKickUser(dest, reason, servername))
63 Channel* n = ServerInstance->FindChan(parameters[1]);
66 ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick)+" SAKICKed "+dest->nick+" on "+parameters[0]);
71 if (!n->HasUser(dest))
73 ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick)+" SAKICKed "+dest->nick+" on "+parameters[0]);
78 user->WriteServ("NOTICE %s :*** Unable to kick %s from %s",user->nick.c_str(), dest->nick.c_str(), parameters[0].c_str());
85 ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick)+" sent remote SAKICK to kick "+dest->nick+" from "+parameters[0]);
92 user->WriteServ("NOTICE %s :*** Invalid nickname or channel", user->nick.c_str());
99 class ModuleSakick : public Module
101 CommandSakick* mycommand;
103 ModuleSakick(InspIRCd* Me)
107 mycommand = new CommandSakick(ServerInstance);
108 ServerInstance->AddCommand(mycommand);
112 virtual ~ModuleSakick()
116 virtual Version GetVersion()
118 return Version("$Id$", VF_COMMON|VF_VENDOR, API_VERSION);
123 MODULE_INIT(ModuleSakick)