]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_globalload.cpp
Update m_cloaking to use free-form keys instead of weakening the hash IV
[user/henk/code/inspircd.git] / src / modules / m_globalload.cpp
index 22035178c0ad8dd20466f320ee0a880975a9e914..636b9f4e4ab10cb404db4f61c27598de8ff39af2 100644 (file)
 class CommandGloadmodule : public Command
 {
  public:
-       CommandGloadmodule (InspIRCd* Instance) : Command(Instance,"GLOADMODULE", "o", 1)
+       CommandGloadmodule(Module* Creator) : Command(Creator,"GLOADMODULE", 1)
        {
-               this->source = "m_globalload.so";
-               syntax = "<modulename> [servermask]";
+               flags_needed = 'o'; syntax = "<modulename> [servermask]";
                TRANSLATE3(TR_TEXT, TR_TEXT, TR_END);
        }
 
@@ -31,7 +30,7 @@ class CommandGloadmodule : public Command
        {
                std::string servername = parameters.size() > 1 ? parameters[1] : "*";
 
-               if (InspIRCd::Match(ServerInstance->Config->ServerName, servername))
+               if (InspIRCd::Match(ServerInstance->Config->ServerName.c_str(), servername))
                {
                        if (ServerInstance->Modules->Load(parameters[0].c_str()))
                        {
@@ -48,6 +47,11 @@ class CommandGloadmodule : public Command
 
                return CMD_SUCCESS;
        }
+
+       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+       {
+               return ROUTE_BROADCAST;
+       }
 };
 
 /** Handle /GUNLOADMODULE
@@ -55,17 +59,16 @@ class CommandGloadmodule : public Command
 class CommandGunloadmodule : public Command
 {
  public:
-       CommandGunloadmodule (InspIRCd* Instance) : Command(Instance,"GUNLOADMODULE", "o", 1)
+       CommandGunloadmodule(Module* Creator) : Command(Creator,"GUNLOADMODULE", 1)
        {
-               this->source = "m_globalload.so";
-               syntax = "<modulename> [servermask]";
+               flags_needed = 'o'; syntax = "<modulename> [servermask]";
        }
 
        CmdResult Handle (const std::vector<std::string> &parameters, User *user)
        {
                std::string servername = parameters.size() > 1 ? parameters[1] : "*";
 
-               if (InspIRCd::Match(ServerInstance->Config->ServerName, servername))
+               if (InspIRCd::Match(ServerInstance->Config->ServerName.c_str(), servername))
                {
                        if (ServerInstance->Modules->Unload(parameters[0].c_str()))
                        {
@@ -82,6 +85,11 @@ class CommandGunloadmodule : public Command
 
                return CMD_SUCCESS;
        }
+
+       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+       {
+               return ROUTE_BROADCAST;
+       }
 };
 
 /** Handle /GRELOADMODULE
@@ -89,17 +97,16 @@ class CommandGunloadmodule : public Command
 class CommandGreloadmodule : public Command
 {
  public:
-       CommandGreloadmodule (InspIRCd* Instance) : Command(Instance, "GRELOADMODULE", "o", 1)
+       CommandGreloadmodule(Module* Creator) : Command(Creator, "GRELOADMODULE", 1)
        {
-               this->source = "m_globalload.so";
-               syntax = "<modulename> [servermask]";
+               flags_needed = 'o'; syntax = "<modulename> [servermask]";
        }
 
        CmdResult Handle(const std::vector<std::string> &parameters, User *user)
        {
                std::string servername = parameters.size() > 1 ? parameters[1] : "*";
 
-               if (InspIRCd::Match(ServerInstance->Config->ServerName, servername))
+               if (InspIRCd::Match(ServerInstance->Config->ServerName.c_str(), servername))
                {
                        bool ok = true;
                        if (!ServerInstance->Modules->Unload(parameters[0].c_str()))
@@ -121,25 +128,26 @@ class CommandGreloadmodule : public Command
 
                return CMD_SUCCESS;
        }
+
+       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+       {
+               return ROUTE_BROADCAST;
+       }
 };
 
 class ModuleGlobalLoad : public Module
 {
-       CommandGloadmodule *mycommand;
-       CommandGunloadmodule *mycommand2;
-       CommandGreloadmodule *mycommand3;
+       CommandGloadmodule cmd1;
+       CommandGunloadmodule cmd2;
+       CommandGreloadmodule cmd3;
 
  public:
-       ModuleGlobalLoad(InspIRCd* Me) : Module(Me)
+       ModuleGlobalLoad()
+               : cmd1(this), cmd2(this), cmd3(this)
        {
-
-               mycommand = new CommandGloadmodule(ServerInstance);
-               mycommand2 = new CommandGunloadmodule(ServerInstance);
-               mycommand3 = new CommandGreloadmodule(ServerInstance);
-               ServerInstance->AddCommand(mycommand);
-               ServerInstance->AddCommand(mycommand2);
-               ServerInstance->AddCommand(mycommand3);
-
+               ServerInstance->AddCommand(&cmd1);
+               ServerInstance->AddCommand(&cmd2);
+               ServerInstance->AddCommand(&cmd3);
        }
 
        virtual ~ModuleGlobalLoad()
@@ -148,7 +156,7 @@ class ModuleGlobalLoad : public Module
 
        virtual Version GetVersion()
        {
-               return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version("Allows global loading of a module.", VF_COMMON | VF_VENDOR, API_VERSION);
        }
 };