summaryrefslogtreecommitdiff
path: root/src/roster.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-01-11 06:43:31 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-01-11 06:43:31 +0100
commit749933fc16005d8e81d54830f532dd1cb9f85773 (patch)
treebd34b228e49f83c225afdd8ea9fa661b5ec36504 /src/roster.py
parent6bb94cdf0b88671b2ac12eb67f70555da565f238 (diff)
downloadpoezio-749933fc16005d8e81d54830f532dd1cb9f85773.tar.gz
poezio-749933fc16005d8e81d54830f532dd1cb9f85773.tar.bz2
poezio-749933fc16005d8e81d54830f532dd1cb9f85773.tar.xz
poezio-749933fc16005d8e81d54830f532dd1cb9f85773.zip
/accept and /deny commands
User can now decide to accept or deny a subscription, in the roster
Diffstat (limited to 'src/roster.py')
-rw-r--r--src/roster.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/roster.py b/src/roster.py
index 1abc1cd3..1fd1099d 100644
--- a/src/roster.py
+++ b/src/roster.py
@@ -37,9 +37,17 @@ class Roster(object):
"""
Add a contact to the contact list
"""
- assert jid not in self._contacts
self._contacts[jid] = contact
+ def remove_contact(self, jid):
+ """
+ Remove a contact from the contact list
+ """
+ contact = self.get_contact_by_jid(jid)
+ for group in contact._groups:
+ group.remove_contact_from_group(contact)
+ del self._contacts[jid]
+
def get_contact_len(self):
"""
Return the number of contacts in this group
@@ -110,6 +118,12 @@ class Roster(object):
"""
return self._roster_groups
+ def get_contacts(self):
+ """
+ Return a list of all the contact
+ """
+ return [contact for contact in self._contacts.values()]
+
def save_to_config_file(self):
"""
Save various information to the config file
@@ -127,7 +141,7 @@ class Roster(object):
"""
length = 0
for group in self._roster_groups:
- if group.get_nb_connected_contacts() == 0:
+ if config.get('roster_show_offline', 'false') == 'false' and group.get_nb_connected_contacts() == 0:
continue
length += 1 # One for the group's line itself
if not group.folded: