mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-24 09:20:43 +01:00
relay: re-add / in hosts for networks that support it
This commit is contained in:
parent
3339bf0fe6
commit
ef8ec03e41
@ -172,13 +172,18 @@ def normalize_nick(irc, netname, nick, times_tagged=0, uid=''):
|
|||||||
|
|
||||||
return nick
|
return nick
|
||||||
|
|
||||||
ALLOWED_HOST_CHARS = string.ascii_letters + string.digits + '-.:'
|
|
||||||
def normalize_host(irc, host):
|
def normalize_host(irc, host):
|
||||||
"""Creates a normalized hostname for the given host suitable for
|
"""Creates a normalized hostname for the given host suitable for
|
||||||
introduction to a remote network (as a relay client)."""
|
introduction to a remote network (as a relay client)."""
|
||||||
log.debug('(%s) relay.normalize_host: IRCd=%s, host=%s', irc.name, irc.protoname, host)
|
log.debug('(%s) relay.normalize_host: IRCd=%s, host=%s', irc.name, irc.protoname, host)
|
||||||
|
|
||||||
|
allowed_chars = string.ascii_letters + string.digits + '-.:'
|
||||||
|
if irc.protoname in ('inspircd', 'ts6', 'clientbot', 'nefarious'):
|
||||||
|
# UnrealIRCd and IRCd-Hybrid don't allow slashes in hostnames
|
||||||
|
allowed_chars += '/'
|
||||||
|
|
||||||
for char in host:
|
for char in host:
|
||||||
if char not in ALLOWED_HOST_CHARS:
|
if char not in allowed_chars:
|
||||||
host = host.replace(char, '-')
|
host = host.replace(char, '-')
|
||||||
|
|
||||||
return host[:63] # Limit hosts to 63 chars for best compatibility
|
return host[:63] # Limit hosts to 63 chars for best compatibility
|
||||||
|
Loading…
x
Reference in New Issue
Block a user