From 3a2c2a916a26f4fa1844e71a9f1c2fc25337fd2b Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 19 May 2010 16:59:16 -0400 Subject: Dont load mlock from the database until after Anope is connected, it doesnt know all of the available modes until then --- src/core/db_plain.cpp | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) (limited to 'src/core') diff --git a/src/core/db_plain.cpp b/src/core/db_plain.cpp index 868374813..710d4eb50 100644 --- a/src/core/db_plain.cpp +++ b/src/core/db_plain.cpp @@ -793,39 +793,20 @@ class DBPlain : public Module { bool Set = key == "MLOCK_ON" ? true : false; - for (unsigned j = 0; j < params.size(); ++j) - { - for (std::list::iterator it = ModeManager::Modes.begin(); it != ModeManager::Modes.end(); ++it) - { - if ((*it)->Class == MC_CHANNEL) - { - ChannelMode *cm = dynamic_cast(*it); - - if (cm->NameAsString == params[j]) - { - ci->SetMLock(cm->Name, Set); - } - } - } - } + /* For now store mlock in extensible, Anope hasn't yet connected to the IRCd and doesn't know what modes exist */ + ci->Extend(Set ? "db_mlock_modes_on" : "db_mlock_modes_off", new ExtensibleItemRegular >(params)); } else if (key == "MLP") { + std::vector > mlp; + for (unsigned j = 0; j < params.size(); ++j, ++j) { - for (std::list::iterator it = ModeManager::Modes.begin(); it != ModeManager::Modes.end(); ++it) - { - if ((*it)->Class == MC_CHANNEL) - { - ChannelMode *cm = dynamic_cast(*it); - - if (cm->NameAsString == params[j]) - { - ci->SetMLock(cm->Name, true, params[j + 1]); - } - } - } + mlp.push_back(std::make_pair(params[j], params[j + 1])); } + + /* For now store mlocked modes in extensible, Anope hasn't yet connected to the IRCd and doesn't know what modes exist */ + ci->Extend("db_mlp", new ExtensibleItemRegular > >(mlp)); } else if (key == "MI") { -- cgit