summaryrefslogtreecommitdiff
path: root/modules/core/db_plain.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-03-09 01:25:49 -0500
committerAdam <Adam@anope.org>2011-03-09 01:25:49 -0500
commite9aa04a8f497bdd6675d9d3ca2d25ba6110c3008 (patch)
tree260cb256ffcae43697ab8118c64e84a36731f9d9 /modules/core/db_plain.cpp
parent8eb23e7d489239e8af79c2d6da587cd1c3a81b5d (diff)
Store mlock in the databases and removed some unused functions from misc.cpp
Diffstat (limited to 'modules/core/db_plain.cpp')
-rw-r--r--modules/core/db_plain.cpp94
1 files changed, 14 insertions, 80 deletions
diff --git a/modules/core/db_plain.cpp b/modules/core/db_plain.cpp
index 44b5cbefa..c20a78577 100644
--- a/modules/core/db_plain.cpp
+++ b/modules/core/db_plain.cpp
@@ -614,32 +614,17 @@ class DBPlain : public Module
ak->SetFlag(AK_ISNICK);
}
- else if (key.equals_ci("MLOCK_ON") || key.equals_ci("MLOCK_OFF"))
+ else if (key.equals_ci("MLOCK"))
{
- bool Set = key.equals_ci("MLOCK_ON");
+ std::vector<Anope::string> mlocks;
+ ci->GetExtRegular("db_mlock", mlocks);
- /* 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<std::vector<Anope::string> >(params));
- }
- else if (key.equals_ci("MLP"))
- {
- std::vector<std::pair<Anope::string, Anope::string> > mlp;
- ci->GetExtRegular("db_mlp", mlp);
-
- mlp.push_back(std::make_pair(params[0], params[1]));
+ Anope::string mlock_string = params[0] + " " + params[1] + " " + params[2] + " " + params[3];
+ if (params.size() > 4)
+ mlock_string += " " + params[4];
- /* 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<std::vector<std::pair<Anope::string, Anope::string> > >(mlp));
- }
- else if (key.equals_ci("MLP_OFF"))
- {
- std::vector<std::pair<Anope::string, Anope::string> > mlp;
- ci->GetExtRegular("db_mlp_off", mlp);
-
- mlp.push_back(std::make_pair(params[0], params[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_off", new ExtensibleItemRegular<std::vector<std::pair<Anope::string, Anope::string> > >(mlp));
+ mlocks.push_back(mlock_string);
+ ci->Extend("db_mlock", new ExtensibleItemRegular<std::vector<Anope::string> >(mlocks));
}
else if (key.equals_ci("MI"))
{
@@ -832,70 +817,19 @@ class DBPlain : public Module
db_buffer << ci->GetAkick(k)->reason;
db_buffer << endl;
}
- db_buffer << "MD MLOCK_ON";
- {
- std::vector<Anope::string> oldmodes;
- if ((!Me || !Me->IsSynced()) && ci->GetExtRegular("db_mlock_modes_on", oldmodes))
- for (unsigned i = 0; i < oldmodes.size(); ++i)
- db_buffer << " " << oldmodes[i];
- else
- {
- for (std::multimap<ChannelModeName, ModeLock>::const_iterator it = ci->GetMLock().begin(), it_end = ci->GetMLock().end(); it != it_end; ++it)
- {
- const ModeLock &ml = it->second;
- if (ml.set)
- {
- ChannelMode *cm = ModeManager::FindChannelModeByName(ml.name);
- if (!cm || cm->Type != MODE_REGULAR)
- continue;
- db_buffer << " " << cm->NameAsString();
- }
- }
- }
- }
- db_buffer << endl;
- db_buffer << "MD MLOCK_OFF";
- {
- std::vector<Anope::string> oldmodes;
- if ((!Me || !Me->IsSynced()) && ci->GetExtRegular("db_mlock_modes_off", oldmodes))
- for (unsigned i = 0; i < oldmodes.size(); ++i)
- db_buffer << " " << oldmodes[i];
- else
- {
- for (std::multimap<ChannelModeName, ModeLock>::const_iterator it = ci->GetMLock().begin(), it_end = ci->GetMLock().end(); it != it_end; ++it)
- {
- const ModeLock &ml = it->second;
- if (!ml.set)
- {
- ChannelMode *cm = ModeManager::FindChannelModeByName(ml.name);
- if (!cm || cm->Type != MODE_REGULAR)
- continue;
- db_buffer << " " << cm->NameAsString();
- }
- }
- }
- }
- db_buffer << endl;
{
- std::vector<std::pair<Anope::string, Anope::string> > oldparams;;
- if ((!Me || !Me->IsSynced()) && ci->GetExtRegular("db_mlp", oldparams))
- {
- for (std::vector<std::pair<Anope::string, Anope::string> >::iterator it = oldparams.begin(), it_end = oldparams.end(); it != it_end; ++it)
- {
- db_buffer << "MD MLP " << it->first << " " << it->second << endl;
- }
- }
+ std::vector<Anope::string> mlocks;
+ if (ci->GetExtRegular("db_mlock", mlocks))
+ for (unsigned i = 0; i < mlocks.size(); ++i)
+ db_buffer << mlocks[i] << endl;
else
{
for (std::multimap<ChannelModeName, ModeLock>::const_iterator it = ci->GetMLock().begin(), it_end = ci->GetMLock().end(); it != it_end; ++it)
{
const ModeLock &ml = it->second;
ChannelMode *cm = ModeManager::FindChannelModeByName(ml.name);
- if (!cm)
- continue;
-
- if (!ml.param.empty())
- db_buffer << "MD MLP" << (ml.set ? " " : "_OFF ") << cm->NameAsString() << " " << ml.param << endl;
+ if (cm != NULL)
+ db_buffer << "MD MLOCK " << (ml.set ? 1 : 0) << " " << cm->NameAsString() << " " << ml.setter << " " << ml.created << " " << ml.param << endl;
}
}
}