diff options
-rw-r--r-- | data/example.conf | 10 | ||||
-rw-r--r-- | include/config.h | 2 | ||||
-rw-r--r-- | src/config.cpp | 1 | ||||
-rw-r--r-- | src/protocol.cpp | 6 |
4 files changed, 17 insertions, 2 deletions
diff --git a/data/example.conf b/data/example.conf index 534b99fa3..c1fc5c20d 100644 --- a/data/example.conf +++ b/data/example.conf @@ -320,6 +320,16 @@ networkinfo modelistsize = 100 /* + * Characters allowed in nicknames. This always includes the characters described + * in RFC1459, and so does not need to be set for normal behavior. Changing this to + * include characters your IRCd doesn't support will cause your IRCd and/or Services + * to break. Multibyte characters are not supported, nor are escape sequences. + * + * It is recommended you DON'T change this. + */ + #nick_chars = "" + + /* * The characters allowed in hostnames. This is used for validating hostnames given * to services, such as BotServ bot hostnames and user vhosts. Changing this is not * recommended unless you know for sure your IRCd supports whatever characters you are diff --git a/include/config.h b/include/config.h index b132c5d2d..2ae6e3ced 100644 --- a/include/config.h +++ b/include/config.h @@ -103,6 +103,8 @@ namespace Configuration time_t TimeoutCheck; /* options:usestrictprivmsg */ bool UseStrictPrivmsg; + /* networkinfo:nickchars */ + Anope::string NickChars; /* either "/msg " or "/" */ Anope::string StrictPrivmsg; diff --git a/src/config.cpp b/src/config.cpp index 3ce4251e7..18a6c5d39 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -191,6 +191,7 @@ Conf::Conf() : Block("") } this->DefLanguage = options->Get<const Anope::string>("defaultlanguage"); this->TimeoutCheck = options->Get<time_t>("timeoutcheck"); + this->NickChars = networkinfo->Get<Anope::string>("nick_chars"); for (int i = 0; i < this->CountBlock("uplink"); ++i) { diff --git a/src/protocol.cpp b/src/protocol.cpp index 05bcb54fe..0d09fee24 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -365,8 +365,10 @@ bool IRCDProto::IsNickValid(const Anope::string &nick) Anope::string special = "[]\\`_^{|}"; for (unsigned i = 0; i < nick.length(); ++i) - if (!(nick[i] >= 'A' && nick[i] <= 'Z') && !(nick[i] >= 'a' && nick[i] <= 'z') && special.find(nick[i]) == Anope::string::npos - && (!i || (!(nick[i] >= '0' && nick[i] <= '9') && nick[i] != '-'))) + if (!(nick[i] >= 'A' && nick[i] <= 'Z') && !(nick[i] >= 'a' && nick[i] <= 'z') + && special.find(nick[i]) == Anope::string::npos + && (Config && Config->NickChars.find(nick[i]) == Anope::string::npos) + && (!i || (!(nick[i] >= '0' && nick[i] <= '9') && nick[i] != '-'))) return false; return true; |