diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-10-13 21:11:14 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-10-13 21:11:14 +0200 |
commit | 1377fabfee72994531df274248ed0ce6de483dd2 (patch) | |
tree | 69739d5b4e017904ca9be10211d7b7ae8e0fb85d /src/modules | |
parent | c8d3cce3a701f9f7786c5efecb457850d89edf6d (diff) |
m_nationalchars Rebuild core hashmaps when the national_case_insensitive_map changes
Issue #923
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_nationalchars.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index b43b6e2b6..20e4eaa9e 100644 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -228,11 +228,24 @@ class ModuleNationalChars : public Module caller2<bool, const char*, size_t> rememberer; bool forcequit; const unsigned char * lowermap_rememberer; + unsigned char prev_map[256]; + + void CheckRehash() + { + // See if anything changed + if (!memcmp(prev_map, national_case_insensitive_map, sizeof(prev_map))) + return; + + memcpy(prev_map, national_case_insensitive_map, sizeof(prev_map)); + + ServerInstance->RehashUsersAndChans(); + } public: ModuleNationalChars() : rememberer(ServerInstance->IsNick), lowermap_rememberer(national_case_insensitive_map) { + memcpy(prev_map, national_case_insensitive_map, sizeof(prev_map)); } void init() @@ -265,6 +278,7 @@ class ModuleNationalChars : public Module loadtables(charset, tables, 8, 5); forcequit = tag->getBool("forcequit"); CheckForceQuit("National character set changed"); + CheckRehash(); } void CheckForceQuit(const char * message) @@ -286,6 +300,7 @@ class ModuleNationalChars : public Module ServerInstance->IsNick = rememberer; national_case_insensitive_map = lowermap_rememberer; CheckForceQuit("National characters module unloaded"); + CheckRehash(); } virtual Version GetVersion() |