1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
19 /* $ModDesc: Allows global loading of a module. */
27 /** Handle /GLOADMODULE
29 class cmd_gloadmodule : public command_t
32 cmd_gloadmodule (InspIRCd* Instance) : command_t(Instance,"GLOADMODULE", 'o', 1)
34 this->source = "m_globalload.so";
35 syntax = "<modulename>";
38 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
40 if (ServerInstance->LoadModule(parameters[0]))
42 ServerInstance->WriteOpers("*** NEW MODULE '%s' GLOBALLY LOADED BY '%s'",parameters[0],user->nick);
43 user->WriteServ("975 %s %s :Module successfully loaded.",user->nick, parameters[0]);
48 user->WriteServ("974 %s %s :Failed to load module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
54 /** Handle /GUNLOADMODULE
56 class cmd_gunloadmodule : public command_t
59 cmd_gunloadmodule (InspIRCd* Instance) : command_t(Instance,"GUNLOADMODULE", 'o', 1)
61 this->source = "m_globalload.so";
62 syntax = "<modulename>";
65 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
67 if (ServerInstance->UnloadModule(parameters[0]))
69 ServerInstance->WriteOpers("*** MODULE '%s' GLOBALLY UNLOADED BY '%s'",parameters[0],user->nick);
70 user->WriteServ("973 %s %s :Module successfully unloaded.",user->nick, parameters[0]);
75 user->WriteServ("972 %s %s :Failed to unload module: %s",user->nick, parameters[0],ServerInstance->ModuleError());
81 class ModuleGlobalLoad : public Module
83 cmd_gloadmodule *mycommand;
84 cmd_gunloadmodule *mycommand2;
87 ModuleGlobalLoad(InspIRCd* Me) : Module::Module(Me)
90 mycommand = new cmd_gloadmodule(ServerInstance);
91 mycommand2 = new cmd_gunloadmodule(ServerInstance);
92 ServerInstance->AddCommand(mycommand);
93 ServerInstance->AddCommand(mycommand2);
96 virtual ~ModuleGlobalLoad()
100 virtual Version GetVersion()
102 return Version(1, 0, 0, 0, VF_VENDOR);
107 class ModuleGlobalLoadFactory : public ModuleFactory
110 ModuleGlobalLoadFactory()
114 ~ModuleGlobalLoadFactory()
118 virtual Module * CreateModule(InspIRCd* Me)
120 return new ModuleGlobalLoad(Me);
126 extern "C" void * init_module( void )
128 return new ModuleGlobalLoadFactory;