From f4c5e0a091e9e56e95ff687654e68e90dc6144e0 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Sun, 17 Oct 2010 17:27:07 +0000 Subject: Multi-resource. Handling stanzas. But the normal conversation window is broken :^). Fixed #1888 --- src/roster.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/roster.py') diff --git a/src/roster.py b/src/roster.py index 72f885bc..03a5f93a 100644 --- a/src/roster.py +++ b/src/roster.py @@ -14,13 +14,11 @@ # You should have received a copy of the GNU General Public License # along with Poezio. If not, see . -from contact import Contact - -from common import debug +from contact import Contact, Resource class Roster(object): def __init__(self): - self._contacts = {} # key = jid; value = Contact() + self._contacts = {} # key = bare jid; value = Contact() self._roster_groups = [] def add_contact(self, contact, jid): @@ -97,6 +95,8 @@ class Roster(object): if not group.folded: for contact in group.get_contacts(): l += 1 + if not contact._folded: + l += contact.get_nb_resources() return l def __repr__(self): @@ -115,10 +115,10 @@ class RosterGroup(object): Online/Offline or whatever """ def __init__(self, name, folded=False): - # debug('New group: %s \n' % name) self._contacts = [] self.name = name self.folded = folded # if the group content is to be shown + def is_empty(self): return len(self._contacts) == 0 @@ -143,3 +143,6 @@ class RosterGroup(object): def __repr__(self): return '' % (self.name, self._contacts) + + def toggle_folded(self): + self.folded = not self.folded -- cgit v1.2.3