diff options
-rw-r--r-- | include/mode.h | 5 | ||||
-rw-r--r-- | src/mode.cpp | 6 | ||||
-rw-r--r-- | src/modules.cpp | 7 |
3 files changed, 11 insertions, 7 deletions
diff --git a/include/mode.h b/include/mode.h index eebfbedd6..d8884bf9f 100644 --- a/include/mode.h +++ b/include/mode.h @@ -168,6 +168,11 @@ class CoreExport ModeHandler : public ServiceProvider ModeHandler(Module* me, const std::string& name, char modeletter, ParamSpec params, ModeType type, Class mclass = MC_OTHER); virtual CullResult cull(); virtual ~ModeHandler(); + + /** Register this object in the ModeParser + */ + void RegisterService() CXX11_OVERRIDE; + /** * Returns true if the mode is a list mode */ diff --git a/src/mode.cpp b/src/mode.cpp index 671b5d854..6038f6f5b 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -90,6 +90,12 @@ bool ModeHandler::ResolveModeConflict(std::string& theirs, const std::string& ou return (theirs < ours); } +void ModeHandler::RegisterService() +{ + ServerInstance->Modes.AddMode(this); + ServerInstance->Modules.AddReferent((GetModeType() == MODETYPE_CHANNEL ? "mode/" : "umode/") + name, this); +} + ModeAction SimpleUserModeHandler::OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { /* We're either trying to add a mode we already have or diff --git a/src/modules.cpp b/src/modules.cpp index d28657ca8..f5998f79c 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -556,13 +556,6 @@ void ModuleManager::AddService(ServiceProvider& item) { switch (item.service) { - case SERVICE_MODE: - { - ModeHandler* mh = static_cast<ModeHandler*>(&item); - ServerInstance->Modes->AddMode(mh); - AddReferent((mh->GetModeType() == MODETYPE_CHANNEL ? "mode/" : "umode/") + item.name, &item); - return; - } case SERVICE_METADATA: if (!ServerInstance->Extensions.Register(static_cast<ExtensionItem*>(&item))) throw ModuleException("Extension " + std::string(item.name) + " already exists."); |