diff options
author | Adam <Adam@anope.org> | 2016-10-17 18:33:55 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-10-17 18:33:55 -0400 |
commit | 22d166fd4e98b67cac7103b48801fb95a0179f01 (patch) | |
tree | 300b00bd52c5d3a26978bfe23bbdc2adc9c0fa26 /src/hashcomp.cpp | |
parent | 1ba242179fee46583098f48421af39ce9a8985a1 (diff) |
Address casemapping issues in sqlite/mysql
Diffstat (limited to 'src/hashcomp.cpp')
-rw-r--r-- | src/hashcomp.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 265cb362b..72e729eba 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -212,6 +212,18 @@ bool Anope::compare_locale::operator()(const Anope::string &s1, const Anope::str return Anope::compare_ci()(s1, s2); } +Anope::string Anope::transform(const Anope::string &s) +{ +#ifdef Boost_FOUND + if (Config != nullptr && Config->locale != nullptr) + { + return Anope::locale::transform(s.str()); + } +#endif + + return s.lower(); +} + #ifdef Boost_FOUND std::locale Anope::locale::generate(const std::string &name) @@ -240,5 +252,11 @@ long Anope::locale::hash(const std::string &s) return ct.hash(boost::locale::collator_base::secondary, s.data(), s.data() + s.length()); } +std::string Anope::locale::transform(const std::string &s) +{ + const boost::locale::collator<char> &ct = std::use_facet<boost::locale::collator<char>>(*Config->locale); + return ct.transform(boost::locale::collator_base::secondary, s); +} + #endif |