X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmodules.h;h=93e5c05a0fd56f9f1c65da2877bab4239f440d08;hb=489ba0ad54bf6bdd80d5f539f67f03241ddfe77b;hp=3cf7802846f7cc6acd2e817d8b218a1c3e6805f8;hpb=06bc8df45045a3d1fdc45f793abf7ba72b7403b1;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/modules.h b/include/modules.h index 3cf780284..93e5c05a0 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1035,9 +1035,6 @@ class CoreExport ModuleManager : public fakederef PRIO_STATE_LAST } prioritizationState; - /** Internal unload module hook */ - bool CanUnload(Module*); - /** Loads all core modules (cmd_*) */ void LoadCoreModules(std::map& servicemap); @@ -1068,6 +1065,13 @@ class CoreExport ModuleManager : public fakederef */ ServiceList* NewServices; + /** Expands the name of a module by prepending "m_" and appending ".so". + * No-op if the name already has the ".so" extension. + * @param modname Module name to expand + * @return Module name starting with "m_" and ending with ".so" + */ + static std::string ExpandModName(const std::string& modname); + /** Simple, bog-standard, boring constructor. */ ModuleManager(); @@ -1158,18 +1162,19 @@ class CoreExport ModuleManager : public fakederef */ bool Unload(Module* module); - /** Run an asynchronous reload of the given module. When the reload is - * complete, the callback will be run with true if the reload succeeded - * and false if it did not. - */ - void Reload(Module* module, HandlerBase1* callback); - /** Called by the InspIRCd constructor to load all modules from the config file. */ void LoadAll(); void UnloadAll(); void DoSafeUnload(Module*); + /** Check if a module can be unloaded and if yes, prepare it for unload + * @param mod Module to be unloaded + * @return True if the module is unloadable, false otherwise. + * If true the module must be unloaded in the current main loop iteration. + */ + bool CanUnload(Module* mod); + /** Find a module by name, and return a Module* to it. * This is preferred over iterating the module lists yourself. * @param name The module name to look up @@ -1208,6 +1213,17 @@ class CoreExport ModuleManager : public fakederef * @return A ModuleMap containing all loaded modules */ const ModuleMap& GetModules() const { return Modules; } + + /** Make a service referenceable by dynamic_references + * @param name Name that will be used by dynamic_references to find the object + * @param service Service to make referenceable by dynamic_references + */ + void AddReferent(const std::string& name, ServiceProvider* service); + + /** Make a service no longer referenceable by dynamic_references + * @param service Service to make no longer referenceable by dynamic_references + */ + void DelReferent(ServiceProvider* service); }; /** Do not mess with these functions unless you know the C preprocessor