3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +01:00

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.
This commit is contained in:
James Lu 2016-06-19 12:30:34 -07:00
parent e47738c27f
commit bcc754cf0b

View File

@ -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