mirror of
https://github.com/anope/anope.git
synced 2026-06-30 07:56:37 +02:00
Add networkinfo:nick_chars option to allow configuring additional characters allowed in nicknames
This commit is contained in:
@@ -319,6 +319,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
|
||||
|
||||
@@ -103,6 +103,8 @@ namespace Configuration
|
||||
time_t TimeoutCheck;
|
||||
/* options:usestrictprivmsg */
|
||||
bool UseStrictPrivmsg;
|
||||
/* networkinfo:nickchars */
|
||||
Anope::string NickChars;
|
||||
|
||||
/* either "/msg " or "/" */
|
||||
Anope::string StrictPrivmsg;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
+4
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user