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
This commit is contained in:
Guillaume Desmottes 2011-06-24 14:29:23 +02:00
parent 9deca75de8
commit 09f3c87d20
2 changed files with 11 additions and 1 deletions

View File

@ -73,7 +73,7 @@ GIO_MIN_VERSION=2.25.9
LIBECAL_MIN_VERSION=2.32.0 LIBECAL_MIN_VERSION=2.32.0
LIBEDATASERVER_MIN_VERSION=1.2.0 LIBEDATASERVER_MIN_VERSION=1.2.0
LIBEDATASERVERUI_MIN_VERSION=2.91.6 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 TELEPATHY_LOGGER_MIN_VERSION=0.2.4
POLKIT_MIN_VERSION=0.100 POLKIT_MIN_VERSION=0.100
STARTUP_NOTIFICATION_MIN_VERSION=0.11 STARTUP_NOTIFICATION_MIN_VERSION=0.11

View File

@ -91,6 +91,11 @@ Client.prototype = {
this._tpClient.set_handle_channels_func( this._tpClient.set_handle_channels_func(
Lang.bind(this, this._handleChannels)); 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 { try {
this._tpClient.register(); this._tpClient.register();
} catch (e) { } catch (e) {
@ -245,6 +250,11 @@ Client.prototype = {
requests, user_action_time, context) { requests, user_action_time, context) {
this._handlingChannels(account, conn, channels); this._handlingChannels(account, conn, channels);
context.accept(); context.accept();
},
_delegatedChannelsCb: function(client, channels) {
// Nothing to do as we don't make a distinction between observed and
// handled channels.
} }
}; };