summaryrefslogtreecommitdiff
path: root/src/modules/m_codepage.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-06-02 03:43:27 +0100
committerSadie Powell <sadie@witchery.services>2021-06-02 03:43:27 +0100
commit8ef5c350f08aed38b2d64f8770298baf74f03afe (patch)
treed908de5185483a8b658ced2023a575f13f02e0d0 /src/modules/m_codepage.cpp
parent4e38d54da17fa1de449c17a85cb60de1ec157204 (diff)
Send the CHARSET token if using a non-ascii casemapping.
Diffstat (limited to 'src/modules/m_codepage.cpp')
-rw-r--r--src/modules/m_codepage.cpp14
1 files changed, 13 insertions, 1 deletions
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;