mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-23 10:44:09 +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:
parent
e47738c27f
commit
bcc754cf0b
@ -103,11 +103,17 @@ def normalizeNick(irc, netname, nick, separator=None, uid=''):
|
|||||||
orig_nick = nick
|
orig_nick = nick
|
||||||
protoname = irc.protoname
|
protoname = irc.protoname
|
||||||
maxnicklen = irc.maxnicklen
|
maxnicklen = irc.maxnicklen
|
||||||
if '/' not in separator or not protoname.startswith(('insp', 'unreal')):
|
|
||||||
# Charybdis doesn't allow / in usernames, and will SQUIT with
|
# Charybdis, IRCu, etc. don't allow / in nicks, and will SQUIT with a protocol
|
||||||
# a protocol violation if it sees one.
|
# 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('/', '|')
|
separator = separator.replace('/', '|')
|
||||||
nick = nick.replace('/', '|')
|
nick = nick.replace('/', '|')
|
||||||
|
|
||||||
if nick.startswith(tuple(string.digits)):
|
if nick.startswith(tuple(string.digits)):
|
||||||
# On TS6 IRCds, nicks that start with 0-9 are only allowed if
|
# On TS6 IRCds, nicks that start with 0-9 are only allowed if
|
||||||
# they match the UID of the originating server. Otherwise, you'll
|
# they match the UID of the originating server. Otherwise, you'll
|
||||||
|
Loading…
Reference in New Issue
Block a user