diff options
author | Matt Schatz <genius3000@g3k.solutions> | 2019-11-17 05:06:48 -0700 |
---|---|---|
committer | P. Powell <petpow@saberuk.com> | 2019-11-18 11:07:19 +0000 |
commit | 36d7ee44a8c697a702211bb767d7a5c912300dfd (patch) | |
tree | 5bcefdadf4b9efa2be2f85869e77e2829e283607 | |
parent | 43da9c32321aafb29a82e98a06bc0e139bb3864d (diff) |
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.
-rw-r--r-- | src/modules/m_nationalchars.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
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<bool(const std::string&)> rememberer; bool forcequit; const unsigned char * lowermap_rememberer; + std::string casemapping_rememberer; unsigned char prev_map[256]; template <typename T> @@ -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(); } |