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. --- docs/conf/codepages/iso-8859-1.conf.example | 2 +- docs/conf/codepages/iso-8859-2.conf.example | 2 +- src/modules/m_codepage.cpp | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/conf/codepages/iso-8859-1.conf.example b/docs/conf/codepages/iso-8859-1.conf.example index 83a772600..a5217cf73 100644 --- a/docs/conf/codepages/iso-8859-1.conf.example +++ b/docs/conf/codepages/iso-8859-1.conf.example @@ -1,6 +1,6 @@ # This file contains ISO 8859-1 codepage rules for use with the codepage module. - + # ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ # ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö diff --git a/docs/conf/codepages/iso-8859-2.conf.example b/docs/conf/codepages/iso-8859-2.conf.example index df41d88fb..61dd78230 100644 --- a/docs/conf/codepages/iso-8859-2.conf.example +++ b/docs/conf/codepages/iso-8859-2.conf.example @@ -1,6 +1,6 @@ # This file contains ISO 8859-2 codepage rules for use with the codepage module. - + # Ą # Ł 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