From 36d7ee44a8c697a702211bb767d7a5c912300dfd Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Sun, 17 Nov 2019 05:06:48 -0700 Subject: Change Config->CaseMapping back when unloading. Now that casemapping is configurable in the core and we set that Config variable rather than just modifying the ISupport output each time, we need to change the variable back when being unloaded. So we save the current value when loading and set it back when being unloaded. We also need to call the ISupport builder a second time as the core calls it before we destruct. --- src/modules/m_nationalchars.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index 2b7e66a50..dbeff6db9 100644 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -222,6 +222,7 @@ class ModuleNationalChars : public Module TR1NS::function rememberer; bool forcequit; const unsigned char * lowermap_rememberer; + std::string casemapping_rememberer; unsigned char prev_map[256]; template @@ -248,7 +249,9 @@ class ModuleNationalChars : public Module public: ModuleNationalChars() - : rememberer(ServerInstance->IsNick), lowermap_rememberer(national_case_insensitive_map) + : rememberer(ServerInstance->IsNick) + , lowermap_rememberer(national_case_insensitive_map) + , casemapping_rememberer(ServerInstance->Config->CaseMapping) { memcpy(prev_map, national_case_insensitive_map, sizeof(prev_map)); } @@ -305,6 +308,9 @@ class ModuleNationalChars : public Module { ServerInstance->IsNick = rememberer; national_case_insensitive_map = lowermap_rememberer; + ServerInstance->Config->CaseMapping = casemapping_rememberer; + // The core rebuilds ISupport on module unload, but before the dtor. + ServerInstance->ISupport.Build(); CheckForceQuit("National characters module unloaded"); CheckRehash(); } -- cgit v1.2.3