From 09f3c87d20f68e99eaf79d600a2900e57f727e9f Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 24 Jun 2011 14:29:23 +0200 Subject: [PATCH] Allow other clients to preempt the channels we are handling This is needed if we are handling an incoming text channel and then user tries to open a chat with the same contact using Empathy. In this case, the Shell should delegate the channel back to Empathy and just continue observing it as it does for usual outgoing channels. Depends on telepathy-glib 0.15.3 as tp_base_client_set_delegated_channels_callback() has been added in this version. https://bugzilla.gnome.org/show_bug.cgi?id=654237 --- configure.ac | 2 +- js/ui/telepathyClient.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5ec4021c1..9e4d03cc1 100644 --- a/configure.ac +++ b/configure.ac @@ -73,7 +73,7 @@ GIO_MIN_VERSION=2.25.9 LIBECAL_MIN_VERSION=2.32.0 LIBEDATASERVER_MIN_VERSION=1.2.0 LIBEDATASERVERUI_MIN_VERSION=2.91.6 -TELEPATHY_GLIB_MIN_VERSION=0.15.0 +TELEPATHY_GLIB_MIN_VERSION=0.15.3 TELEPATHY_LOGGER_MIN_VERSION=0.2.4 POLKIT_MIN_VERSION=0.100 STARTUP_NOTIFICATION_MIN_VERSION=0.11 diff --git a/js/ui/telepathyClient.js b/js/ui/telepathyClient.js index e0bd8d063..5c51f3121 100644 --- a/js/ui/telepathyClient.js +++ b/js/ui/telepathyClient.js @@ -91,6 +91,11 @@ Client.prototype = { this._tpClient.set_handle_channels_func( Lang.bind(this, this._handleChannels)); + // Allow other clients (such as Empathy) to pre-empt our channels if + // needed + this._tpClient.set_delegated_channels_callback( + Lang.bind(this, this._delegatedChannelsCb)); + try { this._tpClient.register(); } catch (e) { @@ -245,6 +250,11 @@ Client.prototype = { requests, user_action_time, context) { this._handlingChannels(account, conn, channels); context.accept(); + }, + + _delegatedChannelsCb: function(client, channels) { + // Nothing to do as we don't make a distinction between observed and + // handled channels. } };