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 support for an SAQUIT command, exits user with a reason */
20 class CommandSaquit : public Command
23 CommandSaquit(Module* Creator) : Command(Creator, "SAQUIT", 2, 2)
25 flags_needed = 'o'; Penalty = 0; syntax = "<nick> <reason>";
26 TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
29 CmdResult Handle (const std::vector<std::string>& parameters, User *user)
31 User* dest = ServerInstance->FindNick(parameters[0]);
34 if (ServerInstance->ULine(dest->server))
36 user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str());
40 // Pass the command on, so the client's server can quit it properly.
44 ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick)+" used SAQUIT to make "+std::string(dest->nick)+" quit with a reason of "+parameters[1]);
46 ServerInstance->Users->QuitUser(dest, parameters[1]);
51 user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick.c_str(), parameters[0].c_str());
56 RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
58 User* dest = ServerInstance->FindNick(parameters[0]);
60 return ROUTE_OPT_UCAST(dest->server);
61 return ROUTE_LOCALONLY;
65 class ModuleSaquit : public Module
72 ServerInstance->AddCommand(&cmd);
75 virtual ~ModuleSaquit()
79 virtual Version GetVersion()
81 return Version("Provides support for an SAQUIT command, exits user with a reason", VF_OPTCOMMON | VF_VENDOR, API_VERSION);
86 MODULE_INIT(ModuleSaquit)