]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Send the CHARSET token if using a non-ascii casemapping.
authorSadie Powell <sadie@witchery.services>
Wed, 2 Jun 2021 02:43:27 +0000 (03:43 +0100)
committerSadie Powell <sadie@witchery.services>
Wed, 2 Jun 2021 02:43:27 +0000 (03:43 +0100)
docs/conf/codepages/iso-8859-1.conf.example
docs/conf/codepages/iso-8859-2.conf.example
src/modules/m_codepage.cpp

index 83a7726008c2c2e81a2df37dd66fa3bef9ab4757..a5217cf73ddd1d5e08e7dfe6cdd3e3e8adfe5250 100644 (file)
@@ -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"> # ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö
index df41d88fb6151f2888202ef0fca3b48b1a5faca5..61dd7823018170788baace1e7f20ce391adf61a9 100644 (file)
@@ -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">           # Ł
index 45fdb3d834ae02e2b312c2c5b68403cdba7a3dbd..f299b92fa4b7f843f6dda7b5c050984bd6c10128 100644 (file)
@@ -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;