X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_sakick.cpp;h=afca49e251ba17b3294670277915a5f17b8b0bd5;hb=a5d110282a864fd2e91b51ce360a977cd0643657;hp=feceeee993f8cd6b9aa429a94ec2f29e7e688017;hpb=2630a87bb13b089e6d0fdcff4bcd0f3a9612e52f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index feceeee99..afca49e25 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -1,16 +1,23 @@ -/* +------------------------------------+ - * | 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 */ @@ -20,10 +27,9 @@ class CommandSakick : public Command { public: - CommandSakick (InspIRCd* Instance) : Command(Instance,"SAKICK", "o", 2, 3, false, 0) + CommandSakick(Module* Creator) : Command(Creator,"SAKICK", 2, 3) { - this->source = "m_sakick.so"; - syntax = " [reason]"; + flags_needed = 'o'; Penalty = 0; syntax = " [reason]"; TRANSLATE4(TR_TEXT, TR_NICK, TR_TEXT, TR_END); } @@ -32,9 +38,8 @@ class CommandSakick : public Command User* dest = ServerInstance->FindNick(parameters[1]); Channel* channel = ServerInstance->FindChan(parameters[0]); const char* reason = ""; - const char* servername = NULL; - if (dest && channel) + if ((dest) && (dest->registered == REG_ALL) && (channel)) { if (parameters.size() > 2) { @@ -57,22 +62,13 @@ class CommandSakick : public Command */ if (IS_LOCAL(dest)) { - if (!channel->ServerKickUser(dest, reason, servername)) - delete channel; - - Channel *n = ServerInstance->FindChan(parameters[1]); - 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()); - return CMD_FAILURE; - } + channel->KickUser(ServerInstance->FakeClient, dest, reason); } 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; @@ -84,16 +80,28 @@ class CommandSakick : public Command return CMD_FAILURE; } + + RouteDescriptor GetRouting(User* user, const std::vector& parameters) + { + User* dest = ServerInstance->FindNick(parameters[1]); + if (dest) + return ROUTE_OPT_UCAST(dest->server); + return ROUTE_LOCALONLY; + } }; class ModuleSakick : public Module { CommandSakick cmd; public: - ModuleSakick(InspIRCd* Me) - : Module(Me), cmd(Me) + ModuleSakick() + : cmd(this) + { + } + + void init() { - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(cmd); } virtual ~ModuleSakick() @@ -102,7 +110,7 @@ class ModuleSakick : public Module virtual Version GetVersion() { - return Version("$Id$", VF_COMMON|VF_VENDOR, API_VERSION); + return Version("Provides a SAKICK command", VF_OPTCOMMON|VF_VENDOR); } };