3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-17 23:52:49 +01:00

unreal: move setting irc.connected to AFTER protocol negotiation, and add missing EOS (ENDBURST) handler

The lack of the latter caused relay to *fail* to spawn users whenever an Unreal server reconnects, which should be fixed now.
This commit is contained in:
James Lu 2015-12-24 18:09:52 -08:00
parent bd8aa4dc11
commit 3f45450969

View File

@ -21,7 +21,8 @@ class UnrealProtocol(TS6BaseProtocol):
self.min_proto_ver = 3999
self.hook_map = {'UMODE2': 'MODE', 'SVSKILL': 'KILL', 'SVSMODE': 'MODE',
'SVS2MODE': 'MODE', 'SJOIN': 'JOIN', 'SETHOST': 'CHGHOST',
'SETIDENT': 'CHGIDENT', 'SETNAME': 'CHGNAME'}
'SETIDENT': 'CHGIDENT', 'SETNAME': 'CHGNAME',
'EOS': 'ENDBURST'}
self.uidgen = {}
self.sidgen = utils.TS6SIDGenerator(self.irc)
@ -298,7 +299,9 @@ class UnrealProtocol(TS6BaseProtocol):
f('NETINFO 1 %s %s * 0 0 0 :%s' % (self.irc.start_ts, self.proto_ver, self.irc.serverdata.get("netname", self.irc.name)))
self._send(self.irc.sid, 'EOS')
self.irc.connected.set()
def handle_eos(self, numeric, command, args):
"""EOS is used to denote end of burst."""
return {}
def handle_uid(self, numeric, command, args):
# <- :001 UID GL 0 1441306929 gl localhost 0018S7901 0 +iowx * midnight-1C620195 fwAAAQ== :realname
@ -445,6 +448,10 @@ class UnrealProtocol(TS6BaseProtocol):
self.irc.cmodes.update({'halfop': 'h', 'admin': 'a', 'owner': 'q',
'op': 'o', 'voice': 'v'})
# Set irc.connected to True, meaning that protocol negotiation passed.
log.debug('(%s) self.irc.connected set!', self.irc.name)
self.irc.connected.set()
def _getNick(self, target):
"""Converts a nick argument to its matching UID. This differs from utils.nickToUid()
in that it returns the original text instead of None, if no matching nick is found."""