From 5288eb159451aea53168c1a812a72594801f6421 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Mon, 15 Jul 2013 00:20:28 +0200 Subject: Seperate ModeReference into ChanModeReference and UserModeReference --- src/channels.cpp | 2 +- src/configreader.cpp | 2 +- src/modules.cpp | 11 +++++++---- src/modules/m_banredirect.cpp | 2 +- src/modules/m_check.cpp | 2 +- src/modules/m_spanningtree/netburst.cpp | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src') 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 #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(*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(&item))) + { + ModeHandler* mh = static_cast(&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(&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 BanRedirectList; class BanRedirect : public ModeWatcher { - ModeReference ban; + ChanModeReference ban; public: SimpleExtItem 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(*ban)->DoSyncChannel(c, Utils->Creator, this); } -- cgit v1.2.3