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 <tch@sugarlabs.org>
This commit is contained in:
parent
c374b63990
commit
0494f704fb
@ -554,6 +554,7 @@ class _JoinCommand(_BaseCommand):
|
|||||||
self._finished = False
|
self._finished = False
|
||||||
self.room_handle = room_handle
|
self.room_handle = room_handle
|
||||||
self._global_self_handle = None
|
self._global_self_handle = None
|
||||||
|
self._tubes_supported = True
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self._finished:
|
if self._finished:
|
||||||
@ -581,7 +582,7 @@ class _JoinCommand(_BaseCommand):
|
|||||||
self.room_handle,
|
self.room_handle,
|
||||||
True,
|
True,
|
||||||
reply_handler=self.__create_tubes_channel_cb,
|
reply_handler=self.__create_tubes_channel_cb,
|
||||||
error_handler=self.__error_handler_cb,
|
error_handler=self.__tubes_error_handler_cb,
|
||||||
dbus_interface=CONNECTION)
|
dbus_interface=CONNECTION)
|
||||||
|
|
||||||
def __create_text_channel_cb(self, channel_path):
|
def __create_text_channel_cb(self, channel_path):
|
||||||
@ -592,6 +593,15 @@ class _JoinCommand(_BaseCommand):
|
|||||||
Channel(self._connection.requested_bus_name, channel_path,
|
Channel(self._connection.requested_bus_name, channel_path,
|
||||||
ready_handler=self.__tubes_channel_ready_cb)
|
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):
|
def __error_handler_cb(self, error):
|
||||||
self._finished = True
|
self._finished = True
|
||||||
self.emit('finished', error)
|
self.emit('finished', error)
|
||||||
@ -608,7 +618,7 @@ class _JoinCommand(_BaseCommand):
|
|||||||
|
|
||||||
def _tubes_ready(self):
|
def _tubes_ready(self):
|
||||||
if self.text_channel is None or \
|
if self.text_channel is None or \
|
||||||
self.tubes_channel is None:
|
(self._tubes_supported and self.tubes_channel is None):
|
||||||
return
|
return
|
||||||
|
|
||||||
_logger.debug('%r: finished setting up tubes' % self)
|
_logger.debug('%r: finished setting up tubes' % self)
|
||||||
|
Loading…
Reference in New Issue
Block a user