[Sugar-devel] [PATCH] Announce file transfer capabilities #1603

Simon Schampijer simon at schampijer.de
Mon Sep 20 06:49:52 EDT 2010


On 09/16/2010 06:58 PM, Tomeu Vizoso wrote:
> ---
>   src/jarabe/model/neighborhood.py |   23 ++++++++++++++++++++++-
>   1 files changed, 22 insertions(+), 1 deletions(-)
>
> diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
> index eabdbc0..27f3b53 100644
> --- a/src/jarabe/model/neighborhood.py
> +++ b/src/jarabe/model/neighborhood.py
> @@ -27,12 +27,16 @@ from telepathy.interfaces import ACCOUNT, \
>                                    CHANNEL, \
>                                    CHANNEL_INTERFACE_GROUP, \
>                                    CHANNEL_TYPE_CONTACT_LIST, \
> +                                 CHANNEL_TYPE_FILE_TRANSFER, \
> +                                 CLIENT, \
>                                    CONNECTION, \
>                                    CONNECTION_INTERFACE_ALIASING, \
>                                    CONNECTION_INTERFACE_CONTACTS, \
> +                                 CONNECTION_INTERFACE_CONTACT_CAPABILITIES, \
>                                    CONNECTION_INTERFACE_REQUESTS, \
>                                    CONNECTION_INTERFACE_SIMPLE_PRESENCE
> -from telepathy.constants import HANDLE_TYPE_LIST, \
> +from telepathy.constants import HANDLE_TYPE_CONTACT, \
> +                                HANDLE_TYPE_LIST, \
>                                   CONNECTION_PRESENCE_TYPE_OFFLINE, \
>                                   CONNECTION_STATUS_CONNECTED, \
>                                   CONNECTION_STATUS_DISCONNECTED
> @@ -298,6 +302,20 @@ class _Account(gobject.GObject):
>       def __get_self_handle_cb(self, self_handle):
>           self._self_handle = self_handle
>
> +        if CONNECTION_INTERFACE_CONTACT_CAPABILITIES in self._connection:
> +            connection = \
> +                    self._connection[CONNECTION_INTERFACE_CONTACT_CAPABILITIES]
> +            connection.UpdateCapabilities(
> +                [(CLIENT + '.Sugar.FileTransfer', [
> +                    { CHANNEL + '.ChannelType':
> +                        CHANNEL_TYPE_FILE_TRANSFER,
> +                        CHANNEL + '.TargetHandleType':
> +                        HANDLE_TYPE_CONTACT },
> +                ], [])],
> +                reply_handler=self.__update_capabilities_cb,
> +                error_handler=partial(self.__error_handler_cb,
> +                                      'Connection.UpdateCapabilities'))
> +
>           connection = self._connection[CONNECTION_INTERFACE_ALIASING]
>           connection.connect_to_signal('AliasesChanged',
>                                        self.__aliases_changed_cb)
> @@ -351,6 +369,9 @@ class _Account(gobject.GObject):
>                   error_handler=partial(self.__error_handler_cb,
>                                         'Connection.GetMembers'))
>
> +    def __update_capabilities_cb(self):
> +        pass
> +
>       def __aliases_changed_cb(self, aliases):
>           logging.debug('_Account.__aliases_changed_cb')
>           for handle, alias in aliases:

Just in case anyone else reads this - reviewed on irc and Tomeu pushed 
it already.

Regards,
    Simon


More information about the Sugar-devel mailing list