Correctly sort metacontact data if one of the jids is a transport and not in our roster. Fixes #4208, #4195.

This commit is contained in:
Stephan Erb 2008-08-19 21:41:43 +00:00
parent 0bc1ac47f7
commit 433fcafc52
1 changed files with 12 additions and 5 deletions

View File

@ -479,14 +479,21 @@ class Contacts:
contact2 = self.get_contact_with_highest_priority(account2, jid2) contact2 = self.get_contact_with_highest_priority(account2, jid2)
show_list = ['not in roster', 'error', 'offline', 'invisible', 'dnd', show_list = ['not in roster', 'error', 'offline', 'invisible', 'dnd',
'xa', 'away', 'chat', 'online', 'requested', 'message'] 'xa', 'away', 'chat', 'online', 'requested', 'message']
# contact can be null when we fill the roster on connection # contact can be null when a jid listed in the metacontact data
# is not in our roster
if not contact1: if not contact1:
if contact2:
return -1 # prefer the known contact
else:
show1 = 0 show1 = 0
priority1 = 0 priority1 = 0
else: else:
show1 = show_list.index(contact1.show) show1 = show_list.index(contact1.show)
priority1 = contact1.priority priority1 = contact1.priority
if not contact2: if not contact2:
if contact1:
return 1 # prefer the known contact
else:
show2 = 0 show2 = 0
priority2 = 0 priority2 = 0
else: else: