summaryrefslogtreecommitdiff
path: root/src/modules/m_nationalchars.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_nationalchars.cpp')
-rw-r--r--src/modules/m_nationalchars.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp
index b43b6e2b6..bf95f0f9f 100644
--- a/src/modules/m_nationalchars.cpp
+++ b/src/modules/m_nationalchars.cpp
@@ -228,11 +228,37 @@ 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();
+
+ // The OnGarbageCollect() method in m_watch rebuilds the hashmap used by it
+ Module* mod = ServerInstance->Modules->Find("m_watch.so");
+ if (mod)
+ mod->OnGarbageCollect();
+
+ // Send a Request to m_spanningtree asking it to rebuild its hashmaps
+ mod = ServerInstance->Modules->Find("m_spanningtree.so");
+ if (mod)
+ {
+ Request req(this, mod, "rehash");
+ req.Send();
+ }
+ }
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 +291,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 +313,7 @@ class ModuleNationalChars : public Module
ServerInstance->IsNick = rememberer;
national_case_insensitive_map = lowermap_rememberer;
CheckForceQuit("National characters module unloaded");
+ CheckRehash();
}
virtual Version GetVersion()