All pastes #830033 Raw Edit

Unnamed

public text v1 · immutable
#830033 ·published 2007-12-23 18:43 UTC
rendered paste body
=== modified file 'telepathy_butterfly/channel.py'
--- telepathy_butterfly/channel.py	2007-11-13 17:56:59 +0000
+++ telepathy_butterfly/channel.py	2007-12-23 18:41:36 +0000
@@ -125,7 +125,8 @@
 
     def __init__(self, connection, handle):
         ButterflyListChannel.__init__(self, connection, handle)
-        self.GroupFlagsChanged(0, 0) # no contact Management for now
+        self.GroupFlagsChanged(telepathy.CHANNEL_GROUP_FLAG_CAN_ADD | \
+                               telepathy.CHANNEL_GROUP_FLAG_CAN_REMOVE, 0)
 
     def contact_added(self, handle, contact):
         added = set()
@@ -136,6 +137,17 @@
             self.MembersChanged('', added, (), (), (), 0,
                                 telepathy.CHANNEL_GROUP_CHANGE_REASON_NONE)
 
+    def RemoveMembers(self, contacts, message):
+        ab = self._conn._pymsn_client.address_book
+        for h in contacts:
+            handle = self._conn._handle_manager.\
+                handle_for_handle_id(telepathy.HANDLE_TYPE_CONTACT, h)
+            contact = self._conn._contact_for_handle(handle)
+            ab.delete_contact(contact)
+
+            self.MembersChanged(message, (), contacts, (), (), 0,
+                                telepathy.CHANNEL_GROUP_CHANGE_REASON_NONE)
+
 class ButterflyPublishListChannel(ButterflyListChannel):
 
     def __init__(self, connection, handle):
@@ -156,6 +168,9 @@
             self.MembersChanged('', added, (), local_pending, (), 0,
                                 telepathy.CHANNEL_GROUP_CHANGE_REASON_NONE)
 
+    def RemoveMembers(self, contacts, message):
+        pass
+
 class ButterflyHideListChannel(ButterflyListChannel):
 
     def __init__(self, connection, handle):