- def RequestHandles(self, handleType, names, sender):
- """
- For org.freedesktop.telepathy.Connection
- """
- self.check_connected()
- self.check_handleType(handleType)
-
- handles = []
- for name in names:
- name = name.encode('utf-8')
- if handleType == telepathy.HANDLE_TYPE_CONTACT:
- h = self._create_contact_handle(name)
- elif handleType == telepathy.HANDLE_TYPE_LIST:
- h = handle.create_handle(self, 'list', name)
- elif handleType == telepathy.HANDLE_TYPE_GROUP:
- h = handle.create_handle(self, 'group', name)
- else:
- raise telepathy.NotAvailable('Handle type unsupported %d' % handleType)
- handles.append(h.id)
- self.add_client_handle(handle, sender)
- return handles
-
- def _create_contact_handle(self, name):
- requestedContactId, requestedContactName = handle.field_split(name)
-
- contacts = self._backend.get_contacts()
- contactsFound = [
- (contactId, contactName) for (contactId, contactName) in contacts
- if contactName == name
- ]
+ def generate_props(self, channelType, handle, suppressHandler, initiatorHandle=None):
+ targetHandle = 0 if handle is None else handle.get_id()
+ targetHandleType = telepathy.HANDLE_TYPE_NONE if handle is None else handle.get_type()
+ props = {
+ telepathy.CHANNEL_INTERFACE + '.ChannelType': channelType,
+ telepathy.CHANNEL_INTERFACE + '.TargetHandle': targetHandle,
+ telepathy.CHANNEL_INTERFACE + '.TargetHandleType': targetHandleType,
+ telepathy.CHANNEL_INTERFACE + '.Requested': suppressHandler
+ }