From bcc754cf0b050e204c5e53eff49127b1b5819c9e Mon Sep 17 00:00:00 2001 From: James Lu Date: Sun, 19 Jun 2016 12:30:34 -0700 Subject: [PATCH] relay: allow forcing slashes on unsupported IRCds This adds an undocumented option "relay_force_slashes" to allow slashes in nicks anyways, for IRCds that are, for example, TS6 or P10 variations that don't validate remote nicks. --- plugins/relay.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/relay.py b/plugins/relay.py index 07f9a27..2c64c15 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -103,11 +103,17 @@ def normalizeNick(irc, netname, nick, separator=None, uid=''): orig_nick = nick protoname = irc.protoname maxnicklen = irc.maxnicklen - if '/' not in separator or not protoname.startswith(('insp', 'unreal')): - # Charybdis doesn't allow / in usernames, and will SQUIT with - # a protocol violation if it sees one. + + # Charybdis, IRCu, etc. don't allow / in nicks, and will SQUIT with a protocol + # violation if it sees one. Or it might just ignore the client introduction and + # cause bad desyncs. + protocol_allows_slashes = protoname.startswith(('insp', 'unreal')) or \ + irc.serverdata.get('relay_force_slashes') + + if '/' not in separator or not protocol_allows_slashes: separator = separator.replace('/', '|') nick = nick.replace('/', '|') + if nick.startswith(tuple(string.digits)): # On TS6 IRCds, nicks that start with 0-9 are only allowed if # they match the UID of the originating server. Otherwise, you'll