diff --git a/classes.py b/classes.py index 66d7a56..9b2f31d 100644 --- a/classes.py +++ b/classes.py @@ -728,6 +728,24 @@ class Protocol(): for p in self.irc.channels[channel].prefixmodes.values(): p.clear() + def _getSid(self, sname): + """Returns the SID of a server with the given name, if present.""" + name = sname.lower() + for k, v in self.irc.servers.items(): + if v.name.lower() == name: + return k + else: + return sname # Fall back to given text instead of None + + def _getUid(self, target): + """Converts a nick argument to its matching UID. This differs from irc.nickToUid() + in that it returns the original text instead of None, if no matching nick is found.""" + target = self.irc.nickToUid(target) or target + if target not in self.irc.users and not utils.isChannel(target): + log.debug("(%s) Possible desync? Got command target %s, who " + "isn't in our user list!", self.irc.name, target) + return target + ### FakeIRC classes, used for test cases class FakeIRC(Irc): diff --git a/protocols/ts6_common.py b/protocols/ts6_common.py index 953ef47..13750b5 100644 --- a/protocols/ts6_common.py +++ b/protocols/ts6_common.py @@ -35,24 +35,6 @@ class TS6BaseProtocol(Protocol): args[0] = args[0].split(':', 1)[1] return args - def _getSid(self, sname): - """Returns the SID of a server with the given name, if present.""" - name = sname.lower() - for k, v in self.irc.servers.items(): - if v.name.lower() == name: - return k - else: - return sname # Fall back to given text instead of None - - def _getUid(self, target): - """Converts a nick argument to its matching UID. This differs from irc.nickToUid() - in that it returns the original text instead of None, if no matching nick is found.""" - target = self.irc.nickToUid(target) or target - if target not in self.irc.users and not utils.isChannel(target): - log.debug("(%s) Possible desync? Got command target %s, who " - "isn't in our user list!", self.irc.name, target) - return target - def _getOutgoingNick(self, uid): """ Returns the outgoing nick for the given UID. In the base ts6_common implementation,