[telepathy-butterfly/master] Permit to add/remove non-pending contacts to/from the allow list
Louis-Francis Ratté-Boulianne
louis-francis.ratte-boulianne at collabora.co.uk
Tue Aug 4 14:08:39 PDT 2009
---
butterfly/channel/contact_list.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/butterfly/channel/contact_list.py b/butterfly/channel/contact_list.py
index 7f2b40d..0fab18f 100644
--- a/butterfly/channel/contact_list.py
+++ b/butterfly/channel/contact_list.py
@@ -301,8 +301,12 @@ class ButterflyPublishListChannel(ButterflyListChannel,
account = handle.account
network = handle.network
ab = self._conn.msn_client.address_book
- ab.accept_contact_invitation(contact, False,
- done_cb=(finished_cb,), failed_cb=(finished_cb,))
+ if contact is not None and contact.is_member(papyon.Membership.PENDING):
+ ab.accept_contact_invitation(contact, False,
+ done_cb=(finished_cb,), failed_cb=(finished_cb,))
+ else:
+ ab.allow_contact(account, network,
+ done_cb=(finished_cb,), failed_cb=(finished_cb,))
@Lockable(mutex, 'rem_publish', 'finished_cb')
def _remove(self, handle_id, finished_cb):
@@ -312,6 +316,9 @@ class ButterflyPublishListChannel(ButterflyListChannel,
if contact.is_member(papyon.Membership.PENDING):
ab.decline_contact_invitation(contact, False, done_cb=finished_cb,
failed_cb=finished_cb)
+ elif contact.is_member(papyon.Membership.ALLOW):
+ ab.disallow_contact(contact, done_cb=(finished_cb,),
+ failed_cb=(finished_cb,))
else:
return True
--
1.5.6.5
More information about the telepathy-commits
mailing list