X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_sapart.cpp;h=afbdbdc870d0fd0ab089f759f524bd843deb215b;hb=c4458ecc70025aeac7ca87115ed0a698e7bbcdad;hp=918a8ca56e2750d636a2f4e72f1c7de514ba2578;hpb=1383dba43e463f292aea094d01f62f355946049d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 918a8ca56..afbdbdc87 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -3,13 +3,13 @@ * +------------------------------------+ * * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * - * + * E-mail: + * + * * * Written by Craig Edwards, Craig McLure, and others. * This program is free but copyrighted software; see - * the file COPYING for details. + * the file COPYING for details. * * --------------------------------------------------- */ @@ -21,10 +21,11 @@ using namespace std; #include "users.h" #include "channels.h" #include "modules.h" +#include "helperfuncs.h" /* $ModDesc: Provides support for unreal-style SAPART command */ -Server *Srv; +static Server *Srv; class cmd_sapart : public command_t { @@ -34,18 +35,20 @@ class cmd_sapart : public command_t this->source = "m_sapart.so"; } - void Handle (char **parameters, int pcnt, userrec *user) + void Handle (const char** parameters, int pcnt, userrec *user) { userrec* dest = Srv->FindNick(std::string(parameters[0])); if (dest) { - for (unsigned int x = 0; x < strlen(parameters[1]); x++) + if (Srv->IsUlined(dest->server)) { - if ((parameters[1][0] != '#') || (parameters[1][x] == ' ') || (parameters[1][x] == ',')) - { - Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name"); - return; - } + WriteServ(user->fd,"990 %s :Cannot use an SA command on a u-lined client",user->nick); + return; + } + if (!IsValidChannelName(parameters[1])) + { + Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name"); + return; } Srv->SendOpers(std::string(user->nick)+" used SAPART to make "+std::string(dest->nick)+" part "+parameters[1]);