summaryrefslogtreecommitdiff
path: root/src/modules/mysql/db_mysql_read.cpp
diff options
context:
space:
mode:
authorAdam <Adam@drink-coca-cola.info>2010-05-19 16:59:16 -0400
committerAdam <Adam@anope.org>2010-06-18 21:03:44 -0400
commit3a2c2a916a26f4fa1844e71a9f1c2fc25337fd2b (patch)
tree93cb603a579699b51b74a450db092ab8db595e1f /src/modules/mysql/db_mysql_read.cpp
parent0358ae062b771a3e018ef147f607eae7d0bd8647 (diff)
Dont load mlock from the database until after Anope is connected, it doesnt know all of the available modes until then
Diffstat (limited to 'src/modules/mysql/db_mysql_read.cpp')
-rw-r--r--src/modules/mysql/db_mysql_read.cpp60
1 files changed, 15 insertions, 45 deletions
diff --git a/src/modules/mysql/db_mysql_read.cpp b/src/modules/mysql/db_mysql_read.cpp
index 79e59c9eb..1b4ce33fa 100644
--- a/src/modules/mysql/db_mysql_read.cpp
+++ b/src/modules/mysql/db_mysql_read.cpp
@@ -272,67 +272,37 @@ static void LoadDatabase()
ci->bantype = atoi(qres[i]["bantype"].c_str());
if (qres[i]["mlock_on"].size())
{
+ std::vector<std::string> modes;
std::string buf;
+
spacesepstream sep(SQLAssign(qres[i]["mlock_on"]));
while (sep.GetToken(buf))
- {
- for (std::list<Mode *>::iterator it = ModeManager::Modes.begin(); it != ModeManager::Modes.end(); ++it)
- {
- if ((*it)->Class == MC_CHANNEL)
- {
- ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
+ modes.push_back(buf);
- if (buf == cm->NameAsString)
- {
- ci->SetMLock(cm->Name, true);
- break;
- }
- }
- }
- }
+ ci->Extend("db_mlock_modes_on", new ExtensibleItemRegular<std::vector<std::string> >(modes));
}
if (qres[i]["mlock_off"].size())
{
+ std::vector<std::string> modes;
std::string buf;
+
spacesepstream sep(SQLAssign(qres[i]["mlock_off"]));
while (sep.GetToken(buf))
- {
- for (std::list<Mode *>::iterator it = ModeManager::Modes.begin(); it != ModeManager::Modes.end(); ++it)
- {
- if ((*it)->Class == MC_CHANNEL)
- {
- ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
+ modes.push_back(buf);
- if (buf == cm->NameAsString)
- {
- ci->SetMLock(cm->Name, false);
- break;
- }
- }
- }
- }
+ ci->Extend("db_mlock_modes_off", new ExtensibleItemRegular<std::vector<std::string> >(modes));
}
if (qres[i]["mlock_params"].size())
{
- std::string buf;
+ std::vector<std::pair<std::string, std::string> > mlp;
+ std::string buf, buf2;
+
spacesepstream sep(SQLAssign(qres[i]["mlock_params"]));
- while (sep.GetToken(buf))
- {
- for (std::list<Mode *>::iterator it = ModeManager::Modes.begin(); it != ModeManager::Modes.end(); ++it)
- {
- if ((*it)->Class == MC_CHANNEL)
- {
- ChannelMode *cm = dynamic_cast<ChannelMode *>(*it);
- if (buf == cm->NameAsString)
- {
- sep.GetToken(buf);
- ci->SetMLock(cm->Name, true, buf);
- break;
- }
- }
- }
- }
+ while (sep.GetToken(buf) && sep.GetToken(buf2))
+ mlp.push_back(std::make_pair(buf, buf2));
+
+ ci->Extend("db_mlp", new ExtensibleItemRegular<std::vector<std::pair<std::string, std::string> > >(mlp));
}
if (qres[i]["entry_message"].size())
ci->entry_message = sstrdup(qres[i]["entry_message"].c_str());