summaryrefslogtreecommitdiff
path: root/modules/database/db_old.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-03-01 21:56:26 -0500
committerAdam <Adam@anope.org>2014-03-01 21:56:26 -0500
commit3ceae33b16ea14c124fae7d4d99a5ada95b17399 (patch)
tree606e25e9f281002f4a5a1d815b8a008c4fb6ae91 /modules/database/db_old.cpp
parent5de4c1fc975446889c829e8dcb6f5854b1197ab4 (diff)
Convert limit and key mlocks in db_old
Diffstat (limited to 'modules/database/db_old.cpp')
-rw-r--r--modules/database/db_old.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/modules/database/db_old.cpp b/modules/database/db_old.cpp
index ec7e74b97..b49a6c46e 100644
--- a/modules/database/db_old.cpp
+++ b/modules/database/db_old.cpp
@@ -142,7 +142,7 @@ enum
LANG_PL /* Polish */
};
-static void process_mlock(ChannelInfo *ci, uint32_t lock, bool status)
+static void process_mlock(ChannelInfo *ci, uint32_t lock, bool status, uint32_t *limit, Anope::string *key)
{
ModeLocks *ml = ci->Require<ModeLocks>("modelocks");
for (unsigned i = 0; i < (sizeof(mlock_infos) / sizeof(mlock_info)); ++i)
@@ -150,7 +150,14 @@ static void process_mlock(ChannelInfo *ci, uint32_t lock, bool status)
{
ChannelMode *cm = ModeManager::FindChannelModeByChar(mlock_infos[i].c);
if (cm && ml)
- ml->SetMLock(cm, status);
+ {
+ if (limit && mlock_infos[i].c == 'l')
+ ml->SetMLock(cm, status, stringify(*limit));
+ else if (key && mlock_infos[i].c == 'k')
+ ml->SetMLock(cm, status, *key);
+ else
+ ml->SetMLock(cm, status);
+ }
}
}
@@ -927,9 +934,11 @@ static void LoadChannels()
READ(read_uint32(&tmpu32, f)); // mlock off
ci->Extend<uint32_t>("mlock_off", tmpu32);
READ(read_uint32(&tmpu32, f)); // mlock limit
- READ(read_string(buffer, f));
- READ(read_string(buffer, f));
- READ(read_string(buffer, f));
+ ci->Extend<uint32_t>("mlock_limit", tmpu32);
+ READ(read_string(buffer, f)); // key
+ ci->Extend<Anope::string>("mlock_key", buffer);
+ READ(read_string(buffer, f)); // +f
+ READ(read_string(buffer, f)); // +L
READ(read_int16(&tmp16, f));
READ(read_int16(&ci->memos.memomax, f));
@@ -1286,11 +1295,12 @@ static void LoadNews()
class DBOld : public Module
{
- PrimitiveExtensibleItem<uint32_t> mlock_on, mlock_off;
+ PrimitiveExtensibleItem<uint32_t> mlock_on, mlock_off, mlock_limit;
+ PrimitiveExtensibleItem<Anope::string> mlock_key;
public:
DBOld(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR),
- mlock_on(this, "mlock_on"), mlock_off(this, "mlock_off")
+ mlock_on(this, "mlock_on"), mlock_off(this, "mlock_off"), mlock_limit(this, "mlock_limit"), mlock_key(this, "mlock_key")
{
@@ -1318,21 +1328,26 @@ class DBOld : public Module
for (registered_channel_map::iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
{
ChannelInfo *ci = it->second;
+ uint32_t *limit = mlock_limit.Get(ci);
+ Anope::string *key = mlock_key.Get(ci);
uint32_t *u = mlock_on.Get(ci);
if (u)
{
- process_mlock(ci, *u, true);
+ process_mlock(ci, *u, true, limit, key);
mlock_on.Unset(ci);
}
u = mlock_off.Get(ci);
if (u)
{
- process_mlock(ci, *u, false);
+ process_mlock(ci, *u, false, limit, key);
mlock_off.Unset(ci);
}
+ mlock_limit.Unset(ci);
+ mlock_key.Unset(ci);
+
if (ci->c)
ci->c->CheckModes();
}