diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/base.h | 7 | ||||
-rw-r--r-- | include/inspircd.h | 5 | ||||
-rw-r--r-- | include/listmode.h | 4 | ||||
-rw-r--r-- | include/modules.h | 20 | ||||
-rw-r--r-- | include/modules/cap.h | 1 |
5 files changed, 24 insertions, 13 deletions
diff --git a/include/base.h b/include/base.h index c6d361576..86aa2769f 100644 --- a/include/base.h +++ b/include/base.h @@ -249,8 +249,11 @@ class CoreExport ServiceProvider : public classbase const std::string name; /** Type of service (must match object type) */ const ServiceType service; - ServiceProvider(Module* Creator, const std::string& Name, ServiceType Type) - : creator(Creator), name(Name), service(Type) {} + ServiceProvider(Module* Creator, const std::string& Name, ServiceType Type); virtual ~ServiceProvider(); + + /** If called, this ServiceProvider won't be registered automatically + */ + void DisableAutoRegister(); }; diff --git a/include/inspircd.h b/include/inspircd.h index 694869423..2e4b02fac 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -714,11 +714,6 @@ class CommandModule : public Module { } - void init() - { - ServerInstance->Modules->AddService(cmd); - } - Version GetVersion() { return Version(cmd.name, VF_VENDOR|VF_CORE); diff --git a/include/listmode.h b/include/listmode.h index e27071eac..e6ca88d4c 100644 --- a/include/listmode.h +++ b/include/listmode.h @@ -157,10 +157,6 @@ class CoreExport ListModeBase : public ModeHandler */ virtual void DoRehash(); - /** Populate the Implements list with the correct events for a List Mode - */ - virtual void DoImplements(Module* m); - /** Handle the list mode. * See mode.h */ diff --git a/include/modules.h b/include/modules.h index 1d9d16f26..e8f0d10fe 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1168,6 +1168,9 @@ typedef IntModuleList::iterator EventHandlerIter; */ class CoreExport ModuleManager { + public: + typedef std::vector<ServiceProvider*> ServiceList; + private: /** Holds a string describing the last module error to occur */ @@ -1189,7 +1192,7 @@ class CoreExport ModuleManager /** Loads all core modules (cmd_*) */ - void LoadCoreModules(); + void LoadCoreModules(std::map<std::string, ServiceList>& servicemap); /** Calls the Prioritize() method in all loaded modules * @return True if all went well, false if a dependency loop was detected @@ -1207,6 +1210,16 @@ class CoreExport ModuleManager /** List of data services keyed by name */ std::multimap<std::string, ServiceProvider*> DataProviders; + /** A list of ServiceProviders waiting to be registered. + * Non-NULL when constructing a Module, NULL otherwise. + * When non-NULL ServiceProviders add themselves to this list on creation and the core + * automatically registers them (that is, call AddService()) after the Module is constructed, + * and before Module::init() is called. + * If a service is created after the construction of the Module (for example in init()) it + * has to be registered manually. + */ + ServiceList* NewServices; + /** Simple, bog-standard, boring constructor. */ ModuleManager(); @@ -1328,6 +1341,11 @@ class CoreExport ModuleManager /** Unregister a service provided by a module */ void DelService(ServiceProvider&); + /** Register all services in a given ServiceList + * @param list The list containing the services to register + */ + void AddServices(const ServiceList& list); + inline void AddServices(ServiceProvider** list, int count) { for(int i=0; i < count; i++) diff --git a/include/modules/cap.h b/include/modules/cap.h index 2ed8df494..7fa5fa969 100644 --- a/include/modules/cap.h +++ b/include/modules/cap.h @@ -45,7 +45,6 @@ class GenericCap const std::string cap; GenericCap(Module* parent, const std::string &Cap) : ext("cap_" + Cap, parent), cap(Cap) { - ServerInstance->Modules->AddService(ext); } void HandleEvent(Event& ev) |