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

get_friendly_name: strip STATUSMSG prefixes before checking is_channel

This commit is contained in:
James Lu 2018-06-08 17:18:39 -07:00
parent 7b744655ee
commit b0188dab92

View File

@ -1225,9 +1225,8 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
return self.servers[entityid].name return self.servers[entityid].name
elif entityid in self.users: elif entityid in self.users:
return self.users[entityid].nick return self.users[entityid].nick
elif self.is_channel(entityid): # Return channels as-is. Remember to strip any STATUSMSG prefixes like from @#channel
# We assume that channels don't conflict with the SID/UID format. For IRC, this is a elif self.is_channel(entityid.lstrip(''.join(self.prefixmodes.values()))):
# relatively safe bet.
return entityid return entityid
else: else:
raise KeyError("Unknown UID/SID %s" % entityid) raise KeyError("Unknown UID/SID %s" % entityid)