3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +01:00

ts6: handle legacy UID by wrapping around EUID

This commit is contained in:
James Lu 2016-09-18 14:13:05 -07:00
parent a7662f8327
commit fe5a40d632

View File

@ -530,8 +530,23 @@ class TS6Protocol(TS6BaseProtocol):
return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip} return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip}
def handle_uid(self, numeric, command, args): def handle_uid(self, numeric, command, args):
raise ProtocolError("Servers should use EUID instead of UID to send users! " """Handles legacy user introductions (UID)."""
"This IS a required capability after all...") # tl;dr We want to convert the following UID parameters:
# nickname, hopcount, nickTS, umodes, username, visible hostname, IP address, UID, gecos
# to EUID parameters when parsing:
# nickname, hopcount, nickTS, umodes, username, visible hostname, IP address, UID,
# real hostname, account name, gecos
euid_args = args[:]
# Insert a * to denote that the user is not logged in.
euid_args.insert(8, '*')
# Copy the visible hostname to the real hostname, as this data isn't sent yet.
# TODO: handle encap realhost / encap login
euid_args.insert(8, args[5])
return self.handle_euid(numeric, command, euid_args)
def handle_sid(self, numeric, command, args): def handle_sid(self, numeric, command, args):
"""Handles incoming server introductions.""" """Handles incoming server introductions."""