コード例 #1
0
ファイル: conn.py プロジェクト: detrout/telepathy-hangups
    def _alter_properties(self, props):
        target_handle_type = props.get(CHANNEL_INTERFACE + '.TargetHandleType',
            HANDLE_TYPE_NONE)
        target_handle = props.get(CHANNEL_INTERFACE + '.TargetHandle', None)
        target_id = props.get(CHANNEL_INTERFACE + '.TargetID', None)

        altered_properties = props.copy()

        if target_handle_type != HANDLE_TYPE_NONE:
            if target_handle == None:
                # Turn TargetID into TargetHandle.
                for handle in self._handles.values():
                    if handle.get_name() == target_id and handle.get_type() == target_handle_type:
                        target_handle = handle.get_id()
                if not target_handle:
                    raise InvalidHandle('TargetID %s not valid for type %d' % (
                        target_id, target_handle_type))

                altered_properties[CHANNEL_INTERFACE + '.TargetHandle'] = \
                    target_handle
            else:
                # Check the supplied TargetHandle is valid
                self.check_handle(target_handle_type, target_handle)

                target_id = self._handles[target_handle_type,\
                                            target_handle].get_name()
                altered_properties[CHANNEL_INTERFACE + '.TargetID'] = \
                    target_id

        altered_properties[CHANNEL_INTERFACE + '.Requested'] = True

        return altered_properties
コード例 #2
0
ファイル: conn.py プロジェクト: detrout/telepathy-hangups
    def GetContactCapabilities(self, handles):
        if 0 in handles:
            raise InvalidHandle('Contact handle list contains zero')

        ret = dbus.Dictionary({}, signature='ua(a{sv}as)')
        for handle in handles:
            self.check_handle(HANDLE_TYPE_CONTACT, handle)
            caps = self._contact_caps.get(handle, [])
            ret[handle] = dbus.Array(caps, signature='(a{sv}as)')

        return ret
コード例 #3
0
ファイル: conn.py プロジェクト: detrout/telepathy-hangups
 def check_handle(self, handle_type, handle):
     if (handle_type, handle) not in self._handles:
         raise InvalidHandle('handle number %d not valid for type %d' %
             (handle, handle_type))