3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-30 23:09:23 +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.""" """Handles the SQUIT command."""
# <- SQUIT services.int :Read error # <- SQUIT services.int :Read error
# Convert the server name to a SID... # 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) return super(UnrealProtocol, self).handle_squit(numeric, 'SQUIT', args)
def handle_protoctl(self, numeric, command, args): def handle_protoctl(self, numeric, command, args):
@ -220,13 +220,6 @@ class UnrealProtocol(TS6BaseProtocol):
elif cap == 'SJ3': elif cap == 'SJ3':
self.caps['SJ3'] = True 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): def _convertNick(self, target):
"""Converts a nick argument to its matching UID.""" """Converts a nick argument to its matching UID."""
target = utils.nickToUid(self.irc, target) or target target = utils.nickToUid(self.irc, target) or target
@ -255,7 +248,7 @@ class UnrealProtocol(TS6BaseProtocol):
args = args[2:] args = args[2:]
# If the sender isn't in UID format, try to convert it automatically. # If the sender isn't in UID format, try to convert it automatically.
# Unreal's protocol isn't quite consistent with this yet! # 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 sender
# parseTS6Args() will raise IndexError if the TS6 sender prefix is missing. # parseTS6Args() will raise IndexError if the TS6 sender prefix is missing.
except IndexError: except IndexError: