X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_sakick.cpp;h=e7dd86d6f6c0eb3ccbbd20769a9847adb8de943b;hb=67de413cad88194972d55a8ff88464370890c5a9;hp=d6b6e965bde7742470cd0c6d9b9ece44f8d7486e;hpb=b16e16ac1bae4ac5494778b4b8a7009febb58137;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index d6b6e965b..e7dd86d6f 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -1,19 +1,24 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ +/* + * InspIRCd -- Internet Relay Chat Daemon * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits + * Copyright (C) 2009 John Brooks + * Copyright (C) 2009 Daniel De Graaf * - * This program is free but copyrighted software; see - * the file COPYING for details. + * 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 + * License as published by the Free Software Foundation, version 2. * - * --------------------------------------------------- + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ -#include "inspircd.h" -/* $ModDesc: Provides a SAKICK command */ +#include "inspircd.h" /** Handle /SAKICK */ @@ -23,7 +28,7 @@ class CommandSakick : public Command CommandSakick(Module* Creator) : Command(Creator,"SAKICK", 2, 3) { flags_needed = 'o'; Penalty = 0; syntax = " [reason]"; - TRANSLATE4(TR_TEXT, TR_NICK, TR_TEXT, TR_END); + TRANSLATE3(TR_TEXT, TR_NICK, TR_TEXT); } CmdResult Handle (const std::vector& parameters, User *user) @@ -32,7 +37,7 @@ class CommandSakick : public Command Channel* channel = ServerInstance->FindChan(parameters[0]); const char* reason = ""; - if (dest && channel) + if ((dest) && (dest->registered == REG_ALL) && (channel)) { if (parameters.size() > 2) { @@ -61,7 +66,7 @@ class CommandSakick : public Command if (n && n->HasUser(dest)) { /* Sort-of-bug: If the command was issued remotely, this message won't be sent */ - user->WriteServ("NOTICE %s :*** Unable to kick %s from %s", user->nick.c_str(), dest->nick.c_str(), parameters[0].c_str()); + user->WriteNotice("*** Unable to kick " + dest->nick + " from " + parameters[0]); return CMD_FAILURE; } } @@ -69,14 +74,14 @@ class CommandSakick : public Command if (IS_LOCAL(user)) { /* Locally issued command; send the snomasks */ - ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick) + " SAKICKed " + dest->nick + " on " + parameters[0]); + ServerInstance->SNO->WriteGlobalSno('a', user->nick + " SAKICKed " + dest->nick + " on " + parameters[0]); } return CMD_SUCCESS; } else { - user->WriteServ("NOTICE %s :*** Invalid nickname or channel", user->nick.c_str()); + user->WriteNotice("*** Invalid nickname or channel"); } return CMD_FAILURE; @@ -98,19 +103,17 @@ class ModuleSakick : public Module ModuleSakick() : cmd(this) { - ServerInstance->AddCommand(&cmd); } - virtual ~ModuleSakick() + void init() CXX11_OVERRIDE { + ServerInstance->Modules->AddService(cmd); } - virtual Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Provides a SAKICK command", VF_OPTCOMMON|VF_VENDOR); } - }; MODULE_INIT(ModuleSakick) -