]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_globops.cpp
Remove InspIRCd* parameters and fields
[user/henk/code/inspircd.git] / src / modules / m_globops.cpp
index 4dbe8dfb598f41fab19e56f0052ff6c619231081..3574ad605e6728491ebab63105dc892dc641b5b6 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
 
 // Globops and +g support module by C.J.Edwards
 
-#include <stdio.h>
-#include <string>
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 #include "inspircd.h"
 
 /* $ModDesc: Provides support for GLOBOPS and user mode +g */
 
 /** Handle /GLOBOPS
  */
-class cmd_globops : public command_t
+class CommandGlobops : public Command
 {
  public:
-       cmd_globops (InspIRCd* Instance) : command_t(Instance,"GLOBOPS",'o',1)
+       CommandGlobops(Module* Creator) : Command(Creator,"GLOBOPS", 1,1)
        {
-               this->source = "m_globops.so";
-               syntax = "<any-text>";
+               flags_needed = 'o'; syntax = "<any-text>";
+               TRANSLATE2(TR_TEXT, TR_END);
        }
 
-       CmdResult Handle (const char** parameters, int pcnt, userrec *user)
+       CmdResult Handle (const std::vector<std::string> &parameters, User *user)
        {
                std::string line = "From " + std::string(user->nick) + ": ";
-               for (int i = 0; i < pcnt; i++)
+               for (int i = 0; i < (int)parameters.size(); i++)
                {
-                       line = line + std::string(parameters[i]) + " ";
+                       line = line + parameters[i] + " ";
                }
                ServerInstance->SNO->WriteToSnoMask('g',line);
 
                /* route it (ofc :p) */
                return CMD_SUCCESS;
        }
+
+       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+       {
+               return ROUTE_BROADCAST;
+       }
 };
 
 class ModuleGlobops : public Module
 {
-       cmd_globops* mycommand;
+       CommandGlobops cmd;
  public:
-       ModuleGlobops(InspIRCd* Me)
-               : Module(Me)
+       ModuleGlobops()
+               : cmd(this)
        {
-               mycommand = new cmd_globops(ServerInstance);
-               ServerInstance->AddCommand(mycommand);
+               ServerInstance->AddCommand(&cmd);
                ServerInstance->SNO->EnableSnomask('g',"GLOBOPS");
+
        }
-       
+
        virtual ~ModuleGlobops()
        {
                ServerInstance->SNO->DisableSnomask('g');
-               DELETE(mycommand);
        }
-       
+
        virtual Version GetVersion()
        {
-               return Version(1, 1, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version("Provides support for GLOBOPS and user mode +g", VF_COMMON | VF_VENDOR, API_VERSION);
        }
 
-       void Implements(char* List)
-       {
-       }
 };
 
-class ModuleGlobopsFactory : public ModuleFactory
-{
- public:
-       ModuleGlobopsFactory()
-       {
-       }
-       
-       ~ModuleGlobopsFactory()
-       {
-       }
-       
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleGlobops(Me);
-       }
-       
-};
-
-
-extern "C" DllExport void * init_module( void )
-{
-       return new ModuleGlobopsFactory;
-}
-
+MODULE_INIT(ModuleGlobops)