summaryrefslogtreecommitdiff
path: root/modules/database/db_old.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-10-29 21:51:34 -0400
committerAdam <Adam@anope.org>2012-10-29 21:51:34 -0400
commite4c2dcc0c70f574f3ff4f3c10a0e6bbdb0883d85 (patch)
tree3fa2c9112a1068382b57dbdb76ad7cc2b05fcd36 /modules/database/db_old.cpp
parent7bdad857e4c85e46a2ac18045046f5ec4bd701d8 (diff)
Made db_old load up most of the old mode locks
Diffstat (limited to 'modules/database/db_old.cpp')
-rw-r--r--modules/database/db_old.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/modules/database/db_old.cpp b/modules/database/db_old.cpp
index 2550bce78..52f42a20e 100644
--- a/modules/database/db_old.cpp
+++ b/modules/database/db_old.cpp
@@ -82,6 +82,33 @@ else \
#define OLD_BS_KICK_FLOOD 0x02000000
#define OLD_BS_KICK_REPEAT 0x01000000
+static struct mlock_info
+{
+ char c;
+ uint32_t m;
+} mlock_infos[] = {
+ {'i', 0x00000001},
+ {'m', 0x00000002},
+ {'n', 0x00000004},
+ {'p', 0x00000008},
+ {'s', 0x00000010},
+ {'t', 0x00000020},
+ {'R', 0x00000100},
+ {'r', 0x00000200},
+ {'c', 0x00000400},
+ {'A', 0x00000800},
+ {'K', 0x00002000},
+ {'O', 0x00008000},
+ {'Q', 0x00010000},
+ {'S', 0x00020000},
+ {'G', 0x00100000},
+ {'C', 0x00200000},
+ {'u', 0x00400000},
+ {'z', 0x00800000},
+ {'N', 0x01000000},
+ {'M', 0x04000000}
+};
+
static Anope::string hashm;
enum
@@ -104,6 +131,17 @@ enum
LANG_PL /* Polish */
};
+static void process_mlock(ChannelInfo *ci, uint32_t lock, bool status)
+{
+ for (unsigned i = 0; i < (sizeof(mlock_infos) / sizeof(mlock_info)); ++i)
+ if (lock & mlock_infos[i].m)
+ {
+ ChannelMode *cm = ModeManager::FindChannelModeByChar(mlock_infos[i].c);
+ if (cm)
+ ci->SetMLock(cm, status);
+ }
+}
+
static const char Base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const char Pad64 = '=';
@@ -781,7 +819,9 @@ static void LoadChannels()
}
READ(read_uint32(&tmpu32, f)); // mlock on
+ process_mlock(ci, tmpu32, true);
READ(read_uint32(&tmpu32, f)); // mlock off
+ process_mlock(ci, tmpu32, false);
READ(read_uint32(&tmpu32, f)); // mlock limit
READ(read_string(buffer, f));
READ(read_string(buffer, f));