diff options
author | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-09 16:56:54 +0000 |
---|---|---|
committer | Robin Burchell w00t@inspircd.org <Robin Burchell w00t@inspircd.org@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-11-09 16:56:54 +0000 |
commit | 65fd49d3628dd8d3bde8f70b58ac458785a261d7 (patch) | |
tree | 0b6148ca77f747d4ef2732e5c004292868fd9bf3 /include/modules.h | |
parent | cd71f37e2d1361498c516715e4b83d5909422327 (diff) |
Move loadModule() and unloadModule() inside ModuleManager::
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1614 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'include/modules.h')
-rw-r--r-- | include/modules.h | 67 |
1 files changed, 42 insertions, 25 deletions
diff --git a/include/modules.h b/include/modules.h index 884ece7eb..4f3962682 100644 --- a/include/modules.h +++ b/include/modules.h @@ -132,27 +132,19 @@ struct ModuleLang_ { char **argv; }; -/** Used to manage modules. - */ -CoreExport class ModuleManager -{ - public: - /** - * Load up a list of modules. - * @param total_modules The number of modules to load - * @param module_list The list of modules to load - **/ - static void LoadModuleList(int total_modules, char **module_list); -}; - /** Every module in Anope is actually a class. */ CoreExport class Module { public: - // XXX :( + /** The module name (e.g. os_modload) + */ std::string name; - char *filename; + + /** The temporary path/filename + */ + std::string filename; + void *handle; time_t time; std::string version; @@ -250,6 +242,40 @@ CoreExport class Module int DelCommand(CommandHash * cmdTable[], const char *name); }; + + + +/** Used to manage modules. + */ +CoreExport class ModuleManager +{ + public: + /** + * Load up a list of modules. + * @param total_modules The number of modules to load + * @param module_list The list of modules to load + **/ + static void LoadModuleList(int total_modules, char **module_list); + + /** + * Loads a given module. + * @param m the module to load + * @param u the user who loaded it, NULL for auto-load + * @return MOD_ERR_OK on success, anything else on fail + */ + static int LoadModule(const std::string &modname, User * u); + + /** + * Unload the given module. + * @param m the module to unload + * @param u the user who unloaded it + * @return MOD_ERR_OK on success, anything else on fail + */ + static int UnloadModule(Module *m, User * u); +}; + + + struct ModuleHash_ { char *name; Module *m; @@ -354,17 +380,8 @@ int addModule(Module *m); /* Add a module to the module hash */ int delModule(Module *m); /* Remove a module from the module hash */ MDE Module *findModule(const char *name); /* Find a module */ -/** Loads a given Anope module into the core, initialising relevant structures, - * and calls the module's constructor. - * @param modname The name of the module to load (e.g. os_modload) - * @param u The user loading the module, or NULL for no user. - * @return XXX, document me. - */ -int loadModule(const std::string &modname, User *u); - int encryption_module_init(void); /* Load the encryption module */ int protocol_module_init(void); /* Load the IRCD Protocol Module up*/ -int unloadModule(Module *m, User *u); /* Unload the given module from the pro */ void moduleCallBackPrepForUnload(const char *mod_name); MDE void moduleCallBackDeleteEntry(ModuleCallBack * prev); MDE char *moduleGetLastBuffer(void); @@ -424,7 +441,7 @@ int destroyEventHook(EvtHook * evh); MDE void moduleInsertLanguage(int langNumber, int ac, const char **av); MDE void moduleNoticeLang(char *source, User *u, int number, ...); -MDE char *moduleGetLangString(User * u, int number); +MDE const char *moduleGetLangString(User * u, int number); MDE void moduleDeleteLanguage(int langNumber); /*************************************************************************/ |