X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_oper%2Fcmd_kill.cpp;h=b60885c6404aa6594d705a7587c6026d2eecad18;hb=43b5073d6f80a8dcb7044ecd127fd5893da033ab;hp=454bab03f30dee3b7824133432f8025407ba1f11;hpb=c67d3103e9f7397f0ab9631bf07a5e5547deb2c3;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_oper/cmd_kill.cpp b/src/coremods/core_oper/cmd_kill.cpp index 454bab03f..b60885c64 100644 --- a/src/coremods/core_oper/cmd_kill.cpp +++ b/src/coremods/core_oper/cmd_kill.cpp @@ -20,46 +20,16 @@ #include "inspircd.h" +#include "core_oper.h" -/** Handle /KILL. - */ -class CommandKill : public Command +CommandKill::CommandKill(Module* parent) + : Command(parent, "KILL", 2, 2) { - std::string lastuuid; - std::string killreason; - - public: - /** Constructor for kill. - */ - CommandKill ( Module* parent) : Command(parent,"KILL",2,2) { - flags_needed = 'o'; - syntax = " "; - TRANSLATE2(TR_CUSTOM, TR_CUSTOM); - } - /** Handle command. - * @param parameters The parameters to the command - * @param user The user issuing the command - * @return A value from CmdResult to indicate command success or failure. - */ - CmdResult Handle(const std::vector& parameters, User *user); - RouteDescriptor GetRouting(User* user, const std::vector& parameters) - { - // FindNick() doesn't work here because we quit the target user in Handle() which - // removes it from the nicklist, so we check lastuuid: if it's empty then this KILL - // was for a local user, otherwise it contains the uuid of the user who was killed. - if (lastuuid.empty()) - return ROUTE_LOCALONLY; - return ROUTE_BROADCAST; - } + flags_needed = 'o'; + syntax = " "; + TRANSLATE2(TR_CUSTOM, TR_CUSTOM); +} - void EncodeParameter(std::string& param, int index) - { - // Manually translate the nick -> uuid (see above), and also the reason (params[1]) - // because we decorate it if the oper is local and want remote servers to see the - // decorated reason not the original. - param = ((index == 0) ? lastuuid : killreason); - } -}; /** Handle /KILL */ @@ -166,5 +136,21 @@ CmdResult CommandKill::Handle (const std::vector& parameters, User return CMD_SUCCESS; } +RouteDescriptor CommandKill::GetRouting(User* user, const std::vector& parameters) +{ + // FindNick() doesn't work here because we quit the target user in Handle() which + // removes it from the nicklist, so we check lastuuid: if it's empty then this KILL + // was for a local user, otherwise it contains the uuid of the user who was killed. + if (lastuuid.empty()) + return ROUTE_LOCALONLY; + return ROUTE_BROADCAST; +} + -COMMAND_INIT(CommandKill) +void CommandKill::EncodeParameter(std::string& param, int index) +{ + // Manually translate the nick -> uuid (see above), and also the reason (params[1]) + // because we decorate it if the oper is local and want remote servers to see the + // decorated reason not the original. + param = ((index == 0) ? lastuuid : killreason); +}