diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_globalload.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 4992b47af..eb6b85a78 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -78,10 +78,43 @@ class cmd_gunloadmodule : public command_t } }; +/** Handle /GRELOADMODULE + */ +class cmd_greloadmodule : public command_t +{ + public: + cmd_greloadmodule (InspIRCd* Instance) : command_t(Instance, "GRELOADMODULE", 'o', 1) + { + this->source = "m_globalload.so"; + syntax = "<modulename>"; + } + + CmdResult Handle(const char** parameters, int pcnt, userrec *user) + { + if (!ServerInstance->UnloadModule(parameters[0])) + { + user->WriteServ("972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->ModuleError()); + return CMD_FAILURE; + } + + if (!ServerInstance->LoadModule(parameters[0])) + { + user->WriteServ("974 %s %s :Failed to load module: %s",user->nick, parameters[0],ServerInstance->ModuleError()); + return CMD_FAILURE; + } + + ServerInstance->WriteOpers("*** MODULE '%s' GLOBALLY RELOADED BY '%s'",parameters[0],user->nick); + user->WriteServ("975 %s %s :Module successfully loaded.",user->nick, parameters[0]); + + return CMD_SUCCESS; + } +}; + class ModuleGlobalLoad : public Module { cmd_gloadmodule *mycommand; cmd_gunloadmodule *mycommand2; + cmd_greloadmodule *mycommand3; public: ModuleGlobalLoad(InspIRCd* Me) : Module::Module(Me) @@ -89,8 +122,10 @@ class ModuleGlobalLoad : public Module mycommand = new cmd_gloadmodule(ServerInstance); mycommand2 = new cmd_gunloadmodule(ServerInstance); + mycommand3 = new cmd_greloadmodule(ServerInstance); ServerInstance->AddCommand(mycommand); ServerInstance->AddCommand(mycommand2); + ServerInstance->AddCommand(mycommand3); } virtual ~ModuleGlobalLoad() |