when you call client.add_friend(jid) in the callback under on_peer_info_received(self, response: PeersInfoResponse): it should return the alias_jid it was called on. otherwise, we can't know which person in a group the private jid it returns belongs to.
right now callback only has the private jid and we don't have any safe way to figure out which alias jid that relates to unless we call client.xiphias_get_users_by_alias(alias_jid) for all members in all groups until we find one with a matching private jid.
while if the call back returns the alias_jid we called it on we can simply make a dictionary like this
users = {}
def on_peer_info_received(self, response: PeersInfoResponse):
users[response.users[0].alias_jid] = response.users[0]
def alias_jid_to_private_jid(jid){
if jid in users:
return users[jid].jid
client.add_friend(jid)
while jid not in users: #this stops it from trying to get the info before the call back gets the info
pass
return users[jid].jid
}
this is a request for an enhancement, as I believe that being able to do this would be a very helpful feature and make programs less error prone
when you call
client.add_friend(jid)
in the callback underon_peer_info_received(self, response: PeersInfoResponse):
it should return thealias_jid
it was called on. otherwise, we can't know which person in a group the private jid it returns belongs to.right now callback only has the private jid and we don't have any safe way to figure out which alias jid that relates to unless we call
client.xiphias_get_users_by_alias(alias_jid)
for all members in all groups until we find one with a matching private jid.while if the call back returns the
alias_jid
we called it on we can simply make a dictionary like thisthis is a request for an enhancement, as I believe that being able to do this would be a very helpful feature and make programs less error prone