X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_saquit.cpp;h=e1db742e0577a5a5fb56b8c5cf5ce099d781d560;hb=ea7aa89d61f5090ee7e7ecbe9eb633e1189ce40a;hp=0c6ca949d7ca7cdd873faa5f9d65875db1a72809;hpb=12cff8dd2f83c8186a41db6075708157dc3c3bd0;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 0c6ca949d..e1db742e0 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -1,3 +1,21 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * Inspire is copyright (C) 2002-2004 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. + * + * --------------------------------------------------- + */ + +using namespace std; + /* * SAQUIT module for InspIRCd * Author: w00t @@ -17,42 +35,52 @@ /* $ModDesc: Provides support for an SAQUIT command, exits user with a reason */ Server *Srv; - -void handle_saquit(char **parameters, int pcnt, userrec *user) + +class cmd_saquit : public command_t { - userrec* dest = Srv->FindNick(std::string(parameters[0])); - if (dest) + public: + cmd_saquit () : command_t("SAQUIT",'o',2) { - std::string line = ""; - for (int i = 1; i < pcnt - 1; i++) + this->source = "m_saquit.so"; + } + + void Handle (char **parameters, int pcnt, userrec *user) + { + userrec* dest = Srv->FindNick(std::string(parameters[0])); + if (dest) { - line = line + std::string(parameters[i]) + " "; + 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); + Srv = Me; + mycommand = new cmd_saquit(); + Srv->AddCommand(mycommand); } virtual ~ModuleSaquit() { - delete Srv; } virtual Version GetVersion() { - return Version(1,0,0,0); + return Version(1,0,0,1,VF_VENDOR); } }; @@ -70,9 +98,9 @@ class ModuleSaquitFactory : public ModuleFactory { } - virtual Module * CreateModule() + virtual Module * CreateModule(Server* Me) { - return new ModuleSaquit; + return new ModuleSaquit(Me); } };