summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2015-01-10 15:17:16 -0500
committerAdam <Adam@anope.org>2015-01-10 15:19:40 -0500
commit32007f81cf0bb475f3621d7637666b06ffa482b9 (patch)
tree10d225b06dab05bcb6553e9ee51a97ab4c804f9c
parent609f87d39fd0d0eeea28aefceca1702e692f2554 (diff)
Add networkinfo:nick_chars option to allow configuring additional characters allowed in nicknames
-rw-r--r--data/example.conf10
-rw-r--r--include/config.h2
-rw-r--r--src/config.cpp1
-rw-r--r--src/protocol.cpp6
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;