Add support for customizing the usable nick length.

This adds a new ISUPPORT token, NICKLEN_USABLE which is strictly an informative value.
NICKLEN is always the maximum runtime NICKLEN supported by the IRCd, as other servers may
have their own usable NICKLEN settings.  As NICKLEN_USABLE is strictly informative, and
NICKLEN is always the maximum possible NICKLEN, any clients which depend on NICKLEN for
memory preallocation will be unaffected by runtime changes to NICKLEN_USABLE.

The default NICKLEN is 50; the default serverinfo::nicklen in the config file is set to
30, which is the NICKLEN presently used on StaticBox.
This commit is contained in:
William Pitcock 2011-11-29 16:10:21 -06:00
parent e2606551a2
commit b583faf970
10 changed files with 46 additions and 9 deletions

View file

@ -138,7 +138,7 @@ mr_nick(struct Client *client_p, struct Client *source_p, int parc, const char *
*s = '\0';
/* copy the nick and terminate it */
rb_strlcpy(nick, parv[1], sizeof(nick));
rb_strlcpy(nick, parv[1], ConfigFileEntry.nicklen);
/* check the nickname is ok */
if(!clean_nick(nick, 1))
@ -201,7 +201,7 @@ m_nick(struct Client *client_p, struct Client *source_p, int parc, const char *p
flood_endgrace(source_p);
/* terminate nick to NICKLEN, we dont want clean_nick() to error! */
rb_strlcpy(nick, parv[1], sizeof(nick));
rb_strlcpy(nick, parv[1], ConfigFileEntry.nicklen);
/* check the nickname is ok */
if(!clean_nick(nick, 1))
@ -566,7 +566,7 @@ clean_nick(const char *nick, int loc_client)
}
/* nicklen is +1 */
if(len >= NICKLEN)
if(len >= NICKLEN && len >= ConfigFileEntry.nicklen)
return 0;
return 1;