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

unreal: switch to _getSid for server name reverse lookup

This commit is contained in:
James Lu 2015-10-12 17:50:44 -07:00
parent 07fce69c5e
commit 4f4ad7b54d

View File

@ -192,7 +192,7 @@ class UnrealProtocol(TS6BaseProtocol):
"""Handles the SQUIT command."""
# <- SQUIT services.int :Read error
# Convert the server name to a SID...
args[0] = self._sidToServer(args[0])
args[0] = self._getSid(args[0])
return super(UnrealProtocol, self).handle_squit(numeric, 'SQUIT', args)
def handle_protoctl(self, numeric, command, args):
@ -220,13 +220,6 @@ class UnrealProtocol(TS6BaseProtocol):
elif cap == 'SJ3':
self.caps['SJ3'] = True
def _sidToServer(self, sname):
"""Returns the SID of a server with the given name, if present."""
nick = sname.lower()
for k, v in self.irc.servers.items():
if v.name.lower() == nick:
return k
def _convertNick(self, target):
"""Converts a nick argument to its matching UID."""
target = utils.nickToUid(self.irc, target) or target
@ -255,7 +248,7 @@ class UnrealProtocol(TS6BaseProtocol):
args = args[2:]
# If the sender isn't in UID format, try to convert it automatically.
# Unreal's protocol isn't quite consistent with this yet!
numeric = self._sidToServer(sender) or utils.nickToUid(self.irc, sender) or \
numeric = self._getSid(sender) or utils.nickToUid(self.irc, sender) or \
sender
# parseTS6Args() will raise IndexError if the TS6 sender prefix is missing.
except IndexError: