From 8ef5c350f08aed38b2d64f8770298baf74f03afe Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 2 Jun 2021 03:43:27 +0100 Subject: Send the CHARSET token if using a non-ascii casemapping. --- src/modules/m_codepage.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_codepage.cpp b/src/modules/m_codepage.cpp index 45fdb3d83..f299b92fa 100644 --- a/src/modules/m_codepage.cpp +++ b/src/modules/m_codepage.cpp @@ -67,6 +67,9 @@ class ModuleCodepage // The IsNick handler which was set before this module was loaded. const TR1NS::function origisnick; + // The character set used for the codepage. + std::string charset; + template void RehashHashmap(T& hashmap) { @@ -138,7 +141,9 @@ class ModuleCodepage void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { - const std::string name = ServerInstance->Config->ConfValue("codepage")->getString("name"); + ConfigTag* codepagetag = ServerInstance->Config->ConfValue("codepage"); + + const std::string name = codepagetag->getString("name"); if (name.empty()) throw ModuleException(" is a required field!"); @@ -200,6 +205,7 @@ class ModuleCodepage lower, lower, upper, upper); } + charset = codepagetag->getString("charset"); std::swap(allowedchars, newallowedchars); std::swap(allowedfrontchars, newallowedfrontchars); std::swap(casemap, newcasemap); @@ -214,6 +220,12 @@ class ModuleCodepage ServerInstance->ISupport.Build(); } + void On005Numeric(std::map& tokens) CXX11_OVERRIDE + { + if (!charset.empty()) + tokens["CHARSET"] = charset; + } + Version GetVersion() CXX11_OVERRIDE { std::stringstream linkdata; -- cgit v1.2.3