diff options
author | DukePyrolator <DukePyrolator@anope.org> | 2012-11-01 05:28:57 +0100 |
---|---|---|
committer | DukePyrolator <DukePyrolator@anope.org> | 2012-11-01 05:28:57 +0100 |
commit | 5b1c8230191fa626ef9210c5035f14a8df4c0ed6 (patch) | |
tree | a4a949838285c89f4f4ea11a9f36073a1f9556e7 /modules/database/db_old.cpp | |
parent | b2b4f21e39041f33a5ee44632ab0dedfd039febf (diff) |
fixed importing mode locks in db_old
Diffstat (limited to 'modules/database/db_old.cpp')
-rw-r--r-- | modules/database/db_old.cpp | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/modules/database/db_old.cpp b/modules/database/db_old.cpp index 52f42a20e..d13dcbe74 100644 --- a/modules/database/db_old.cpp +++ b/modules/database/db_old.cpp @@ -82,6 +82,13 @@ else \ #define OLD_BS_KICK_FLOOD 0x02000000 #define OLD_BS_KICK_REPEAT 0x01000000 +struct ExtensibleItemUint32 : ExtensibleItem +{ + uint32_t u; + ExtensibleItemUint32(uint32_t i) : u(i) { } +}; + + static struct mlock_info { char c; @@ -819,9 +826,9 @@ static void LoadChannels() } READ(read_uint32(&tmpu32, f)); // mlock on - process_mlock(ci, tmpu32, true); + ci->Extend("mlock_on", new ExtensibleItemUint32(tmpu32)); READ(read_uint32(&tmpu32, f)); // mlock off - process_mlock(ci, tmpu32, false); + ci->Extend("mlock_off", new ExtensibleItemUint32(tmpu32)); READ(read_uint32(&tmpu32, f)); // mlock limit READ(read_string(buffer, f)); READ(read_string(buffer, f)); @@ -1044,7 +1051,7 @@ class DBOld : public Module { this->SetAuthor("Anope"); - Implementation i[] = { I_OnLoadDatabase }; + Implementation i[] = { I_OnLoadDatabase, I_OnUplinkSync }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); ConfigReader conf; @@ -1064,6 +1071,28 @@ class DBOld : public Module return EVENT_STOP; } + + void OnUplinkSync(Server *s) anope_override + { + ExtensibleItemUint32 *mlock; + for (registered_channel_map::iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it) + { + ChannelInfo *ci = it->second; + if (ci->HasExt("mlock_on")) + { + mlock = ci->GetExt<ExtensibleItemUint32 *>("mlock_on"); + process_mlock(ci, mlock->u, true); + ci->Shrink("mlock_on"); + } + + if (ci->HasExt("mlock_off")) + { + mlock = ci->GetExt<ExtensibleItemUint32 *>("mlock_off"); + process_mlock(ci, mlock->u, false); + ci->Shrink("mlock_off"); + } + } + } }; MODULE_INIT(DBOld) |