diff options
-rw-r--r-- | include/dynref.h | 10 | ||||
-rw-r--r-- | src/channels.cpp | 2 | ||||
-rw-r--r-- | src/configreader.cpp | 2 | ||||
-rw-r--r-- | src/modules.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_banredirect.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_check.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/netburst.cpp | 2 |
7 files changed, 20 insertions, 11 deletions
diff --git a/include/dynref.h b/include/dynref.h index e605ab794..1d05b35a0 100644 --- a/include/dynref.h +++ b/include/dynref.h @@ -84,10 +84,16 @@ class dynamic_reference_nocheck : public dynamic_reference_base }; class ModeHandler; -class ModeReference : public dynamic_reference_nocheck<ModeHandler> +class ChanModeReference : public dynamic_reference_nocheck<ModeHandler> { public: - ModeReference(Module* mod, const std::string& modename) + ChanModeReference(Module* mod, const std::string& modename) : dynamic_reference_nocheck<ModeHandler>(mod, "mode/" + modename) {} }; +class UserModeReference : public dynamic_reference_nocheck<ModeHandler> +{ + public: + UserModeReference(Module* mod, const std::string& modename) + : dynamic_reference_nocheck<ModeHandler>(mod, "umode/" + modename) {} +}; diff --git a/src/channels.cpp b/src/channels.cpp index 4b701cc3c..0cf05f75d 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -28,7 +28,7 @@ #include <cstdarg> #include "mode.h" -static ModeReference ban(NULL, "ban"); +static ChanModeReference ban(NULL, "ban"); Channel::Channel(const std::string &cname, time_t ts) { diff --git a/src/configreader.cpp b/src/configreader.cpp index 5c70a9e83..b8c54bef9 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -825,7 +825,7 @@ void ConfigReaderThread::Finish() */ ServerInstance->XLines->CheckELines(); ServerInstance->XLines->ApplyLines(); - ModeReference ban(NULL, "ban"); + ChanModeReference ban(NULL, "ban"); static_cast<ListModeBase*>(*ban)->DoRehash(); Config->ApplyDisabledCommands(Config->DisabledCommands); User* user = ServerInstance->FindNick(TheUserUID); diff --git a/src/modules.cpp b/src/modules.cpp index 58a77faff..ca312c4a5 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -415,11 +415,14 @@ void ModuleManager::AddService(ServiceProvider& item) throw ModuleException("Command "+std::string(item.name)+" already exists."); return; case SERVICE_MODE: - if (!ServerInstance->Modes->AddMode(static_cast<ModeHandler*>(&item))) + { + ModeHandler* mh = static_cast<ModeHandler*>(&item); + if (!ServerInstance->Modes->AddMode(mh)) throw ModuleException("Mode "+std::string(item.name)+" already exists."); - DataProviders.insert(std::make_pair("mode/" + item.name, &item)); + DataProviders.insert(std::make_pair((mh->GetModeType() == MODETYPE_CHANNEL ? "mode/" : "umode/") + item.name, &item)); dynamic_reference_base::reset_all(); return; + } case SERVICE_METADATA: if (!ServerInstance->Extensions.Register(static_cast<ExtensionItem*>(&item))) throw ModuleException("Extension " + std::string(item.name) + " already exists."); @@ -427,8 +430,8 @@ void ModuleManager::AddService(ServiceProvider& item) case SERVICE_DATA: case SERVICE_IOHOOK: { - if (item.name.substr(0, 5) == "mode/") - throw ModuleException("The \"mode/\" service name prefix is reserved."); + if ((item.name.substr(0, 5) == "mode/") || (item.name.substr(0, 6) == "umode/")) + throw ModuleException("The \"mode/\" and the \"umode\" service name prefixes are reserved."); DataProviders.insert(std::make_pair(item.name, &item)); std::string::size_type slash = item.name.find('/'); diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index a772794ab..496b0c2c9 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -44,7 +44,7 @@ typedef std::vector<BanRedirectEntry> BanRedirectList; class BanRedirect : public ModeWatcher { - ModeReference ban; + ChanModeReference ban; public: SimpleExtItem<BanRedirectList> extItem; BanRedirect(Module* parent) diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 562a9f661..97d747c5c 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -27,7 +27,7 @@ */ class CommandCheck : public Command { - ModeReference ban; + ChanModeReference ban; public: CommandCheck(Module* parent) : Command(parent,"CHECK", 1) diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 89c8046f5..39056b1fe 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -108,7 +108,7 @@ void TreeSocket::SendFJoins(Channel* c) } this->WriteLine(line); - ModeReference ban(NULL, "ban"); + ChanModeReference ban(NULL, "ban"); static_cast<ListModeBase*>(*ban)->DoSyncChannel(c, Utils->Creator, this); } |