diff options
author | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-11-15 11:59:09 +0000 |
---|---|---|
committer | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-11-15 11:59:09 +0000 |
commit | f4d4a205f136c6373c415657dd35b4f078f25c69 (patch) | |
tree | 8acda5955bd6dd93e50c9fc8926cc511b38d01a5 /src/contact.py | |
parent | de7c007a22fc9f8b6aa9ddd94e55ec4f2b13c71d (diff) | |
download | poezio-f4d4a205f136c6373c415657dd35b4f078f25c69.tar.gz poezio-f4d4a205f136c6373c415657dd35b4f078f25c69.tar.bz2 poezio-f4d4a205f136c6373c415657dd35b4f078f25c69.tar.xz poezio-f4d4a205f136c6373c415657dd35b4f078f25c69.zip |
a few renamings, and some other stuff
Diffstat (limited to 'src/contact.py')
-rw-r--r-- | src/contact.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/contact.py b/src/contact.py index 1eb41f72..8341d4b8 100644 --- a/src/contact.py +++ b/src/contact.py @@ -15,12 +15,15 @@ # along with Poezio. If not, see <http://www.gnu.org/licenses/>. """ -Defines the Resource and Contact classes +Defines the Resource and Contact classes, which are used in +the roster """ -from sleekxmpp.xmlstream.stanzabase import JID + import logging log = logging.getLogger(__name__) +from sleekxmpp.xmlstream.stanzabase import JID + class Resource(object): """ Defines a roster item. @@ -80,8 +83,7 @@ class Contact(object): def get_highest_priority_resource(self): """ - There must be, at any time, at least ONE resource. - And they always should be ordered by priority. + Return the resource with the highest priority """ ret = None for resource in self._resources: @@ -94,8 +96,10 @@ class Contact(object): Called, for example, when a new resource get offline (the first, or any subsequent one) """ - # TODO sort by priority + def f(o): + return o.get_priority() self._resources.append(resource) + self._resources = sorted(self._resources, key=f, reverse=True) def remove_resource(self, resource): """ |