3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 13:09:23 +01:00

unreal: SQUIT and SID handlers (#114)

This commit is contained in:
James Lu 2015-10-09 22:38:28 -07:00
parent d5a2d3b0e8
commit 6e30a62a4a

View File

@ -152,7 +152,6 @@ class UnrealProtocol(TS6BaseProtocol):
def handle_server(self, numeric, command, args):
# <- SERVER unreal.midnight.vpn 1 :U2351-Fhin6OoEM UnrealIRCd test server
sname = args[0]
# TODO: handle introductions for other servers
if numeric == self.irc.uplink:
for cap in self._neededCaps:
if cap not in self.caps:
@ -176,7 +175,25 @@ class UnrealProtocol(TS6BaseProtocol):
"(Unreal 3.4-beta1/2), got %s)" % protover)
self.irc.servers[numeric] = IrcServer(None, sname)
else:
raise NotImplementedError
# Legacy servers can still be introduced this way (without a SID).
raise NotImplementedError("FIXME: we don't handle legacy server "
"introduction yet (using SERVER instead of SID).")
def handle_sid(self, numeric, command, args):
"""Handles the SID command, used for introducing remote servers by our uplink."""
# <- SID services.int 2 00A :Shaltúre IRC Services
sname = args[0].lower()
sid = args[2]
sdesc = args[-1]
self.irc.servers[sid] = IrcServer(numeric, sname, desc=sdesc)
return {'name': sname, 'sid': sid, 'text': sdesc}
def handle_squit(self, numeric, command, args):
"""Handles the SQUIT command."""
# <- SQUIT services.int :Read error
# Convert the server name to a SID...
args[0] = self._sidToServer(args[0])
return super(UnrealProtocol, self).handle_squit(numeric, 'SQUIT', args)
def handle_protoctl(self, numeric, command, args):
# <- PROTOCTL NOQUIT NICKv2 SJOIN SJOIN2 UMODE2 VL SJ3 TKLEXT TKLEXT2 NICKIP ESVID
@ -355,5 +372,4 @@ class UnrealProtocol(TS6BaseProtocol):
utils.applyModes(self.irc, numeric, parsedmodes)
return {'target': numeric, 'modes': parsedmodes}
Class = UnrealProtocol