Sort resources from highest priority to lowest

- Previously it was from lowest to highest
- Add the “Priority:” info to the “i” key in the roster
This commit is contained in:
mathieui 2012-08-01 15:45:10 +02:00
parent 9905646184
commit f76e80c5fa
2 changed files with 4 additions and 3 deletions

View file

@ -148,7 +148,7 @@ class Contact(object):
def get_resources(self):
"""Return all resources, sorted by priority """
compare_resources = lambda x: x.priority
return sorted(self.resources, key=compare_resources)
return sorted(self.resources, key=compare_resources, reverse=True)
def get_highest_priority_resource(self):
"""Return the resource with the highest priority"""

View file

@ -2424,10 +2424,11 @@ class RosterInfoTab(Tab):
res.status if res else '',)
elif isinstance(selected_row, Resource):
res = selected_row
msg = 'Resource: %s (%s)\nCurrent status: %s' % (
msg = 'Resource: %s (%s)\nCurrent status: %s\nPriority: %s' % (
res.jid,
res.presence,
res.status,)
res.status,
res.priority)
elif isinstance(selected_row, RosterGroup):
rg = selected_row
msg = 'Group: %s [%s/%s] contacts online' % (