From 0494f704fb1634037be2ec0b16c627fead567a16 Mon Sep 17 00:00:00 2001 From: Martin Abente Lahaye Date: Mon, 4 Jan 2016 17:34:18 -0300 Subject: [PATCH] collaboration: handle tubes channel failure gracefully CHANNEL_TYPE_TUBES was deprecated since telepathy-gabble 0.17.25 and is no longer present on modern distributions. This breaks collaboration for _all_ activities, regardless if they use tubes or not. Therefore, check if the channel creation failed due to support and allow channel creation process to continue. This patch fixes collaboration for the activities that do not use tubes channel in modern distributions, but also allow to use tubes when running on older distributions. Signed-off-by: Martin Abente Lahaye --- src/sugar3/presence/activity.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/sugar3/presence/activity.py b/src/sugar3/presence/activity.py index 909fb078..65c00e33 100644 --- a/src/sugar3/presence/activity.py +++ b/src/sugar3/presence/activity.py @@ -554,6 +554,7 @@ class _JoinCommand(_BaseCommand): self._finished = False self.room_handle = room_handle self._global_self_handle = None + self._tubes_supported = True def run(self): if self._finished: @@ -581,7 +582,7 @@ class _JoinCommand(_BaseCommand): self.room_handle, True, reply_handler=self.__create_tubes_channel_cb, - error_handler=self.__error_handler_cb, + error_handler=self.__tubes_error_handler_cb, dbus_interface=CONNECTION) def __create_text_channel_cb(self, channel_path): @@ -592,6 +593,15 @@ class _JoinCommand(_BaseCommand): Channel(self._connection.requested_bus_name, channel_path, ready_handler=self.__tubes_channel_ready_cb) + def __tubes_error_handler_cb(self, error): + if (error.get_dbus_name() == + 'org.freedesktop.Telepathy.Error.NotImplemented'): + self._tubes_supported = False + self._tubes_ready() + else: + self._finished = True + self.emit('finished', error) + def __error_handler_cb(self, error): self._finished = True self.emit('finished', error) @@ -608,7 +618,7 @@ class _JoinCommand(_BaseCommand): def _tubes_ready(self): if self.text_channel is None or \ - self.tubes_channel is None: + (self._tubes_supported and self.tubes_channel is None): return _logger.debug('%r: finished setting up tubes' % self)