From 3f45450969f10f3ee098f2607d54fca014964c2c Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 24 Dec 2015 18:09:52 -0800 Subject: [PATCH] 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. --- protocols/unreal.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/protocols/unreal.py b/protocols/unreal.py index a99b1a3..a6b9564 100644 --- a/protocols/unreal.py +++ b/protocols/unreal.py @@ -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."""