summaryrefslogtreecommitdiff
path: root/src/config.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-04-29 15:43:51 -0400
committerAdam <Adam@anope.org>2012-04-29 15:43:51 -0400
commit62818abbf4a39b7641ad2b84d1888ed03b653819 (patch)
tree8ac4d9cf71c728060f2a46f9688c81bea658a234 /src/config.cpp
parent4d9a96e8df6e0baad3fb55310122061de5907016 (diff)
Added options:casemap to chose how case insensitive strings are compared, using ascii, rfc1459, or a locale installed on the system
Diffstat (limited to 'src/config.cpp')
-rw-r--r--src/config.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/config.cpp b/src/config.cpp
index 51a930393..74ba31bd2 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -16,6 +16,7 @@
#include "access.h"
#include "opertype.h"
#include "channels.h"
+#include "hashcomp.h"
/*************************************************************************/
@@ -197,6 +198,22 @@ ServerConfig::ServerConfig() : config_data(), NSDefFlags(NickCoreFlagStrings), C
this->NameServer = "127.0.0.1";
}
}
+
+ if (this->CaseMap == "ascii")
+ Anope::casemap = std::locale(std::locale(), new Anope::ascii_ctype<char>());
+ else if (this->CaseMap == "rfc1459")
+ Anope::casemap = std::locale(std::locale(), new Anope::rfc1459_ctype<char>());
+ else
+ {
+ try
+ {
+ Anope::casemap = std::locale(this->CaseMap.c_str());
+ }
+ catch (const std::runtime_error &)
+ {
+ Log() << "Unknown casemap " << this->CaseMap << " - casemap not changed";
+ }
+ }
}
bool ServerConfig::CheckOnce(const Anope::string &tag)
@@ -1149,6 +1166,7 @@ ConfigItems::ConfigItems(ServerConfig *conf)
{"networkinfo", "nicklen", "31", new ValueContainerUInt(&conf->NickLen), DT_UINTEGER | DT_NORELOAD, ValidateNickLen},
{"networkinfo", "userlen", "10", new ValueContainerUInt(&conf->UserLen), DT_UINTEGER | DT_NORELOAD, NoValidation},
{"networkinfo", "hostlen", "64", new ValueContainerUInt(&conf->HostLen), DT_UINTEGER | DT_NORELOAD, NoValidation},
+ {"options", "casemap", "ascii", new ValueContainerString(&conf->CaseMap), DT_STRING, NoValidation},
{"options", "passlen", "32", new ValueContainerUInt(&conf->PassLen), DT_UINTEGER | DT_NORELOAD, NoValidation},
{"options", "seed", "0", new ValueContainerLUInt(&conf->Seed), DT_LUINTEGER, NoValidation},
{"options", "nobackupokay", "no", new ValueContainerBool(&conf->NoBackupOkay), DT_BOOLEAN, NoValidation},