diff options
author | mathieui <mathieui@mathieui.net> | 2012-05-08 16:14:51 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-05-08 16:14:51 +0200 |
commit | f2377f747bfcd8ecc168c5338b5d5044271cc9a3 (patch) | |
tree | 9541986c8d7f20ecab47e79ab42395c025fdbf27 | |
parent | 784e608f66e0b97d9f08c0b0072478865a560e70 (diff) | |
download | poezio-f2377f747bfcd8ecc168c5338b5d5044271cc9a3.tar.gz poezio-f2377f747bfcd8ecc168c5338b5d5044271cc9a3.tar.bz2 poezio-f2377f747bfcd8ecc168c5338b5d5044271cc9a3.tar.xz poezio-f2377f747bfcd8ecc168c5338b5d5044271cc9a3.zip |
Fix some roster length issues with group folding
-rw-r--r-- | src/roster.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/roster.py b/src/roster.py index 5d21d829..7f93c4b2 100644 --- a/src/roster.py +++ b/src/roster.py @@ -30,10 +30,10 @@ class Roster(object): self.contact_filter = None # A tuple(function, *args) # function to filter contacts, # on search, for example - self.folded_groups = config.get( + self.folded_groups = set(config.get( 'folded_roster_groups', '', - section='var').split(':') + section='var').split(':')) self.groups = {} self.contacts = {} @@ -155,7 +155,7 @@ class Roster(object): for group in self.groups.values(): if not show_offline and group.get_nb_connected_contacts() == 0: continue - if not group in self.folded_groups: + if not group.name in self.folded_groups: for contact in group.get_contacts(self.contact_filter): # We do not count the offline contacts (depending on config) if not show_offline and\ @@ -247,6 +247,12 @@ class RosterGroup(object): def toggle_folded(self): self.folded = not self.folded + if self.folded: + if self.name not in roster.folded_groups: + roster.folded_groups.add(self.name) + else: + if self.name in roster.folded_groups: + roster.folded_groups.remove(self.name) def get_nb_connected_contacts(self): l = 0 |