mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
classes: clean up _expandPUID
Also make the logging less noisy.
This commit is contained in:
parent
b1b14dfb55
commit
b495cb4c5e
21
classes.py
21
classes.py
@ -1686,26 +1686,17 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
|
|||||||
uid, nick)
|
uid, nick)
|
||||||
self.call_hooks([self.sid, 'SAVE', {'target': uid}])
|
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
|
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.
|
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
|
# TODO: stop hardcoding @ as separator
|
||||||
if uid and isinstance(uid, str) and '@' in uid:
|
if isinstance(entityid, str) and '@' in entityid:
|
||||||
if uid in self.users:
|
name = self.get_friendly_name(entityid)
|
||||||
# UID exists and has a @ in it, meaning it's a PUID (orignick@counter style).
|
log.debug('(%s) _expandPUID: mangling pseudo ID %s to %s', self.name, entityid, name)
|
||||||
# Return this user's nick accordingly.
|
return name
|
||||||
nick = self.users[uid].nick
|
return entityid # Regular UID/SID, no change
|
||||||
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
|
|
||||||
|
|
||||||
def wrap_message(self, source, target, text):
|
def wrap_message(self, source, target, text):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user