diff --git a/classes.py b/classes.py index c5a6e70..b275fb9 100644 --- a/classes.py +++ b/classes.py @@ -1686,26 +1686,17 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore): uid, nick) self.call_hooks([self.sid, 'SAVE', {'target': uid}]) - def _expandPUID(self, uid): + def _expandPUID(self, entityid): """ Returns the nick or server name for the given UID/SID. This method helps support protocol modules that use PUIDs internally, as they must convert them to talk with the uplink. """ - log.debug('(%s) _expandPUID: got uid %s', self.name, uid) # TODO: stop hardcoding @ as separator - if uid and isinstance(uid, str) and '@' in uid: - if uid in self.users: - # UID exists and has a @ in it, meaning it's a PUID (orignick@counter style). - # Return this user's nick accordingly. - nick = self.users[uid].nick - log.debug('(%s) Mangling target PUID %s to nick %s', self.name, uid, nick) - return nick - elif uid in self.servers: - # Ditto for servers - sname = self.servers[uid].name - log.debug('(%s) Mangling target PSID %s to server name %s', self.name, uid, sname) - return sname - return uid # Regular UID, no change + if isinstance(entityid, str) and '@' in entityid: + name = self.get_friendly_name(entityid) + log.debug('(%s) _expandPUID: mangling pseudo ID %s to %s', self.name, entityid, name) + return name + return entityid # Regular UID/SID, no change def wrap_message(self, source, target, text): """