[Telepathy-commits] [telepathy-pinocchio/master] implement RemoveMembersWithReason() for ContactList and Group channels
Travis Reitter
travis.reitter at collabora.co.uk
Fri Aug 15 14:15:04 PDT 2008
---
pinocchio/channel/contact_list.py | 38 +++++++++++++++++++++++++++++++++---
1 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/pinocchio/channel/contact_list.py b/pinocchio/channel/contact_list.py
index 4627e66..ae81571 100644
--- a/pinocchio/channel/contact_list.py
+++ b/pinocchio/channel/contact_list.py
@@ -92,6 +92,22 @@ class ContactList(tp.server.ChannelTypeContactList,
contacts -- list of contact handles to add
message -- message to send to server along with request (if supported)
"""
+ self.RemoveMembersWithReason(
+ contacts, message,
+ tp.constants.CHANNEL_GROUP_CHANGE_REASON_NONE)
+
+ def RemoveMembersWithReason(self, contacts, message, reason):
+ """Remove list of contacts from this group.
+
+ Arguments:
+ contacts -- list of contact handles to add
+ message -- message to send to server along with request (if supported)
+ reason -- Channel_Group_Change_Reason as to why the members are being
+ removed
+ """
+ if reason < 0 or reason > tp.constants.LAST_CHANNEL_GROUP_CHANGE_REASON:
+ raise tp.errors.InvalidArgument('invalid group change reason')
+
handle_type = tp.constants.HANDLE_TYPE_CONTACT
for handle_id in contacts:
@@ -104,8 +120,7 @@ class ContactList(tp.server.ChannelTypeContactList,
for x in contacts])
self.MembersChanged(message, (), handle_objs, (), (),
- self._connection._self_handle,
- tp.constants.CHANNEL_GROUP_CHANGE_REASON_NONE)
+ self._connection._self_handle, reason)
self._connection.save()
@@ -179,6 +194,22 @@ class Group(tp.server.ChannelTypeContactList, tp.server.ChannelInterfaceGroup):
contacts -- list of contact handles to add
message -- message to send to server along with request (if supported)
"""
+ self.RemoveMembersWithReason(
+ contacts, message,
+ tp.constants.CHANNEL_GROUP_CHANGE_REASON_NONE)
+
+ def RemoveMembersWithReason(self, contacts, message, reason):
+ """Remove list of contacts from this group.
+
+ Arguments:
+ contacts -- list of contact handles to add
+ message -- message to send to server along with request (if supported)
+ reason -- Channel_Group_Change_Reason as to why the members are being
+ removed
+ """
+ if reason < 0 or reason > tp.constants.LAST_CHANNEL_GROUP_CHANGE_REASON:
+ raise tp.errors.InvalidArgument('invalid group change reason')
+
handle_type = tp.constants.HANDLE_TYPE_CONTACT
for handle_id in contacts:
@@ -191,7 +222,6 @@ class Group(tp.server.ChannelTypeContactList, tp.server.ChannelInterfaceGroup):
for x in contacts])
self.MembersChanged(message, (), handle_objs, (), (),
- self._connection._self_handle,
- tp.constants.CHANNEL_GROUP_CHANGE_REASON_NONE)
+ self._connection._self_handle, reason)
self._connection.save()
--
1.5.6.3
More information about the Telepathy-commits
mailing list