diff options
author | Sadie Powell <sadie@witchery.services> | 2021-06-02 03:43:27 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2021-06-02 03:43:27 +0100 |
commit | 8ef5c350f08aed38b2d64f8770298baf74f03afe (patch) | |
tree | d908de5185483a8b658ced2023a575f13f02e0d0 | |
parent | 4e38d54da17fa1de449c17a85cb60de1ec157204 (diff) |
Send the CHARSET token if using a non-ascii casemapping.
-rw-r--r-- | docs/conf/codepages/iso-8859-1.conf.example | 2 | ||||
-rw-r--r-- | docs/conf/codepages/iso-8859-2.conf.example | 2 | ||||
-rw-r--r-- | 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. -<codepage name="iso-8859-1"> +<codepage name="iso-8859-1" charset="iso-8859-1"> <cpchars begin="192" end="214" front="yes"> # ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ <cpchars begin="216" end="246" front="yes"> # ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö 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. -<codepage name="iso-8859-2"> +<codepage name="iso-8859-2" charset="iso-8859-2"> <cpchars index="161" front="yes"> # Ą <cpchars index="163" front="yes"> # Ł 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<bool(const std::string&)> origisnick; + // The character set used for the codepage. + std::string charset; + template <typename T> 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("<codepage:name> 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<std::string, std::string>& tokens) CXX11_OVERRIDE + { + if (!charset.empty()) + tokens["CHARSET"] = charset; + } + Version GetVersion() CXX11_OVERRIDE { std::stringstream linkdata; |