X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_saquit.cpp;h=d43b9710238d0ac87ace78dd34096e68277e7269;hb=c4458ecc70025aeac7ca87115ed0a698e7bbcdad;hp=525e5b71698241341d49f916b4cbc80fdd3f78f2;hpb=ec7fc489a14af54738da17a94b162a9606df4756;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 525e5b716..d43b97102 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -2,18 +2,20 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * Inspire is copyright (C) 2002-2004 ChatSpike-Dev. - * E-mail: - * - * + * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. + * 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. * * --------------------------------------------------- */ +using namespace std; + /* * SAQUIT module for InspIRCd * Author: w00t @@ -32,38 +34,53 @@ /* $ModDesc: Provides support for an SAQUIT command, exits user with a reason */ -Server *Srv; - -void handle_saquit(char **parameters, int pcnt, userrec *user) +static Server *Srv; + +class cmd_saquit : public command_t { - userrec* dest = Srv->FindNick(std::string(parameters[0])); - if (dest) + public: + cmd_saquit () : command_t("SAQUIT",'o',2) + { + this->source = "m_saquit.so"; + } + + void Handle (const char** parameters, int pcnt, userrec *user) { - std::string line = ""; - for (int i = 1; i < pcnt - 1; i++) + userrec* dest = Srv->FindNick(std::string(parameters[0])); + if (dest) { - line = line + std::string(parameters[i]) + " "; + if (Srv->IsUlined(dest->server)) + { + WriteServ(user->fd,"990 %s :Cannot use an SA command on a u-lined client",user->nick); + return; + } + std::string line = ""; + for (int i = 1; i < pcnt - 1; i++) + { + line = line + std::string(parameters[i]) + " "; + } + line = line + std::string(parameters[pcnt-1]); + + Srv->SendOpers(std::string(user->nick)+" used SAQUIT to make "+std::string(dest->nick)+" quit with a reason of "+line); + Srv->QuitUser(dest, line); } - line = line + std::string(parameters[pcnt-1]); - - Srv->SendOpers(std::string(user->nick)+" used SAQUIT to make "+std::string(dest->nick)+" quit with a reason of "+line); - Srv->QuitUser(dest, line); } -} - +}; class ModuleSaquit : public Module { + cmd_saquit* mycommand; public: - ModuleSaquit() + ModuleSaquit(Server* Me) + : Module::Module(Me) { - Srv = new Server; - Srv->AddCommand("SAQUIT",handle_saquit,'o',2,"m_saquit.so"); + Srv = Me; + mycommand = new cmd_saquit(); + Srv->AddCommand(mycommand); } virtual ~ModuleSaquit() { - delete Srv; } virtual Version GetVersion() @@ -86,9 +103,9 @@ class ModuleSaquitFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSaquit; + return new ModuleSaquit(Me); } };