X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_saquit.cpp;h=d43b9710238d0ac87ace78dd34096e68277e7269;hb=2c6c072c1f5f19d1471feb43fa94bba0030e5fb6;hp=e864546e06057bfa6efc72703b2555ff9f8bac91;hpb=2d821f2980825be73e3f90b47ffff365b0ec5ecb;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index e864546e0..d43b97102 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -2,14 +2,14 @@ * | 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. * * --------------------------------------------------- */ @@ -34,34 +34,49 @@ using namespace std; /* $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(Server* Me) : Module::Module(Me) { Srv = Me; - Srv->AddCommand("SAQUIT",handle_saquit,'o',2,"m_saquit.so"); + mycommand = new cmd_saquit(); + Srv->AddCommand(mycommand); } virtual ~ModuleSaquit()