# Upload accepted on 2012-08-10
retitle 681864 unblock: telepathy-mission-control-5/1:5.12.1-2
thanks

On Tue, 17 Jul 2012 at 12:02:32 +0200, Laurent Bigonville wrote:
> Fixes:
> 
> • Stop using deprecated telepathy-glib symbols. (Jonny)

This is not needed, but is reverted by the patch that Laurent added before
uploading.

> • fdo#51842 - fix access to freed memory. (Xavier)

This is Debian bug #683151, "telepathy-mission-control-5: Random crashes
due to access to freed memory", severity serious. It's the change
to src/mcd-account-manager-default.c.

> • fix existing channel dispatching after using present/delegate. (Jonny)

In particular this fixes the handover of IM conversations between Empathy
and GNOME Shell (Debian bug #683565, which I've just upgraded to important).
The changes in src/mcd-dispatcher.c fix this; the changes to tests/
extend a regression test to simulate more interactions between Empathy
and Shell.

I attach a hopefully-easier-to-read diff, between the version currently in
wheezy and the version in sid, after the debian/patches are applied (i.e.
what actually gets compiled), and excluding files generated by Autotools,
pre-generated documentation and the patch in debian/patches itself.

Of the excluded files, config.guess, config.sub and doc/.../html are
regenerated during the build.

Commands used to generate this diff:

apt-get source telepathy-mission-control-5=1:5.12.0-2
apt-get source telepathy-mission-control-5=1:5.12.1-2
diff -Nur telepathy-mission-control-5-5.12.{0,1} | filterdiff -p1 \
        -x .pc/\* \
        -x config.guess -x config.sub -x INSTALL -x configure -x depcomp \
        -x missing -x install-sh -x ltmain.sh \
        -x debian/patches/\*.patch \
        -x doc/reference/mission-control-plugins/html/\* \
        > filtered.diff

Regards,
    S
diff -Nur telepathy-mission-control-5-5.12.0/ChangeLog telepathy-mission-control-5-5.12.1/ChangeLog
--- telepathy-mission-control-5-5.12.0/ChangeLog	2012-04-02 23:55:00.000000000 +0100
+++ telepathy-mission-control-5-5.12.1/ChangeLog	2012-07-11 11:56:17.000000000 +0100
@@ -1,3 +1,85 @@
+commit e824493e533f7c4ea9ae9066fb29b3298d9a8aa8
+Author: Xavier Claessens <xavier.claess...@collabora.co.uk>
+Date:   2012-07-11 12:49:04 +0200
+
+    Prepare 5.12.1 release
+
+commit 57d7c6360f04d8bc65320c42a5d8929fa3e3bc25
+Author: Xavier Claessens <xavier.claess...@collabora.co.uk>
+Date:   2012-07-11 12:14:11 +0200
+
+    Copy telepathy.am from telepathy-glib
+    
+    It make sure "make -j3 maintainer-foo" works
+
+commit 0daa22ca3858138aee10f8bf46a07fd15c1fcf49
+Author: Xavier Claessens <xavier.claess...@collabora.co.uk>
+Date:   2012-07-09 12:35:01 +0200
+
+    McdAccountManagerDefault: Fix a possible double free
+    
+    If the account is already in the hashtable, g_hash_table_insert()
+    will set @removed as value, but free it since the key already in
+    the table is kept.
+    
+    https://bugs.freedesktop.org/show_bug.cgi?id=51842
+
+commit 150c89d45c6b7d5a2d10bc36cff5689ea1ca72d8
+Author: Will Thompson <will.thomp...@collabora.co.uk>
+Date:   2012-04-05 17:10:18 +0100
+
+    dispatch test: make sure Ensure-ing channels after delegation/presenting works
+
+commit 54f4fd22c09a342bb58da978b5a055e45f968897
+Author: Jonny Lamb <jonny.l...@collabora.co.uk>
+Date:   2012-07-06 16:50:08 +0100
+
+    dispatcher: set channel state back to DISPATCHED after delegating & presenting
+    
+    _mcd_client_proxy_handle_channels sets the McdChannel state to
+    HANDLER_INVOKED, but when we were calling this in both delegate and
+    present operations, the state was not being set back to the DISPATCHED
+    state afterwards.
+    
+    The state being wrong meant that dispatching a channel after if had
+    been delegated or presented would not happen, as MC thought we were
+    still waiting for a handler response.
+    
+    Signed-off-by: Jonny Lamb <jonny.l...@collabora.co.uk>
+
+commit c8ae24ffd03297d097b553997eda3807f1505748
+Author: Jonny Lamb <jonny.l...@collabora.co.uk>
+Date:   2012-07-06 16:49:55 +0100
+
+    dispatcher: add more debug output when delegating channels
+    
+    Signed-off-by: Jonny Lamb <jonny.l...@collabora.co.uk>
+
+commit 3d35096f9ccc69b8c3067ed85102694eda4a2855
+Author: Will Thompson <will.thomp...@collabora.co.uk>
+Date:   2012-04-05 16:56:35 +0100
+
+    Modernize dispatcher/redispatch-channels.py a little
+
+commit 88642511bb9c6f66d2fe4aae1550893eb0d781b2
+Author: Jonny Lamb <jonny.l...@collabora.co.uk>
+Date:   2012-04-03 11:13:55 -0400
+
+    stop using deprecated tp-glib functions
+    
+    tp_*_call_when_ready were replaced by tp_proxy_prepare_async a while
+    ago.
+    
+    Signed-off-by: Jonny Lamb <jonny.l...@collabora.co.uk>
+
+commit edd10ce2948b29859006ca1e149e68097a3bd21b
+Author: Jonny Lamb <jonny.l...@collabora.co.uk>
+Date:   2012-04-02 18:58:07 -0400
+
+    start working on version 5.12.1
+    
+    Signed-off-by: Jonny Lamb <jonny.l...@collabora.co.uk>
+
 commit aeba9f785227e07bf26b14822b1b288041297910
 Author: Jonny Lamb <jonny.l...@collabora.co.uk>
 Date:   2012-04-02 18:22:56 -0400
diff -Nur telepathy-mission-control-5-5.12.0/config.guess telepathy-mission-control-5-5.12.1/config.guess
diff -Nur telepathy-mission-control-5-5.12.0/config.sub telepathy-mission-control-5-5.12.1/config.sub
diff -Nur telepathy-mission-control-5-5.12.0/configure telepathy-mission-control-5-5.12.1/configure
diff -Nur telepathy-mission-control-5-5.12.0/configure.ac telepathy-mission-control-5-5.12.1/configure.ac
--- telepathy-mission-control-5-5.12.0/configure.ac	2012-04-02 23:50:06.000000000 +0100
+++ telepathy-mission-control-5-5.12.1/configure.ac	2012-07-11 11:55:01.000000000 +0100
@@ -1,7 +1,7 @@
 dnl Set the version number to e.g. 5.x.y immediately before a release.
 dnl Set the version number to e.g. 5.x.y+ immediately after (this will
 dnl enable -Werror).
-AC_INIT([telepathy-mission-control], [5.12.0])
+AC_INIT([telepathy-mission-control], [5.12.1])
 
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR(Makefile.am)
diff -Nur telepathy-mission-control-5-5.12.0/debian/changelog telepathy-mission-control-5-5.12.1/debian/changelog
--- telepathy-mission-control-5-5.12.0/debian/changelog	2012-05-09 11:33:50.000000000 +0100
+++ telepathy-mission-control-5-5.12.1/debian/changelog	2012-08-10 14:39:56.000000000 +0100
@@ -1,3 +1,20 @@
+telepathy-mission-control-5 (1:5.12.1-2) unstable; urgency=low
+
+  * Upload to unstable
+  * debian/gbp.conf: Set unstable branch names again.
+  * Add d/p/0001-Revert-stop-using-deprecated-tp-glib-functions.patch:
+    Revert "stop using deprecated tp-glib functions" to minimize delta with
+    current version in wheezy.
+
+ -- Laurent Bigonville <bi...@debian.org>  Tue, 07 Aug 2012 15:32:09 +0200
+
+telepathy-mission-control-5 (1:5.12.1-1) experimental; urgency=low
+
+  * New upstream release. (Closes: #683151)
+  * debian/gbp.conf: Set experimental branch names again.
+
+ -- Jonny Lamb <jo...@debian.org>  Wed, 11 Jul 2012 16:17:34 +0100
+
 telepathy-mission-control-5 (1:5.12.0-2) unstable; urgency=low
 
   * Merge from experimental into unstable
diff -Nur telepathy-mission-control-5-5.12.0/debian/patches/0001-Revert-stop-using-deprecated-tp-glib-functions.patch telepathy-mission-control-5-5.12.1/debian/patches/0001-Revert-stop-using-deprecated-tp-glib-functions.patch
diff -Nur telepathy-mission-control-5-5.12.0/debian/patches/series telepathy-mission-control-5-5.12.1/debian/patches/series
--- telepathy-mission-control-5-5.12.0/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ telepathy-mission-control-5-5.12.1/debian/patches/series	2012-08-10 14:39:56.000000000 +0100
@@ -0,0 +1 @@
+0001-Revert-stop-using-deprecated-tp-glib-functions.patch
diff -Nur telepathy-mission-control-5-5.12.0/depcomp telepathy-mission-control-5-5.12.1/depcomp
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/annotation-glossary.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/annotation-glossary.html
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/api-index-full.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/api-index-full.html
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/ch01.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/ch01.html
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/ch02.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/ch02.html
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/ch03.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/ch03.html
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/ch04.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/ch04.html
Binary files telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/home.png and telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/home.png differ
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/index.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/index.html
Binary files telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/left.png and telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/left.png differ
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/McpAccountManager.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/McpAccountManager.html
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/McpDispatchOperation.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/McpDispatchOperation.html
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/McpRequest.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/McpRequest.html
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/mission-control-plugins-McpAccountStorage.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/mission-control-plugins-McpAccountStorage.html
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/mission-control-plugins-McpDispatchOperationPolicy.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/mission-control-plugins-McpDispatchOperationPolicy.html
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/mission-control-plugins-McpRequestPolicy.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/mission-control-plugins-McpRequestPolicy.html
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/mission-control-plugins-Plugin-loader-and-global-functions.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/mission-control-plugins-Plugin-loader-and-global-functions.html
diff -Nur telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/object-tree.html telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/object-tree.html
Binary files telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/right.png and telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/right.png differ
Binary files telepathy-mission-control-5-5.12.0/doc/reference/mission-control-plugins/html/up.png and telepathy-mission-control-5-5.12.1/doc/reference/mission-control-plugins/html/up.png differ
diff -Nur telepathy-mission-control-5-5.12.0/INSTALL telepathy-mission-control-5-5.12.1/INSTALL
diff -Nur telepathy-mission-control-5-5.12.0/install-sh telepathy-mission-control-5-5.12.1/install-sh
diff -Nur telepathy-mission-control-5-5.12.0/ltmain.sh telepathy-mission-control-5-5.12.1/ltmain.sh
diff -Nur telepathy-mission-control-5-5.12.0/Makefile.in telepathy-mission-control-5-5.12.1/Makefile.in
--- telepathy-mission-control-5-5.12.0/Makefile.in	2012-04-02 23:54:26.000000000 +0100
+++ telepathy-mission-control-5-5.12.1/Makefile.in	2012-07-11 11:55:45.000000000 +0100
@@ -973,9 +973,16 @@
 %.tar.gz.asc: %.tar.gz
 	$(AM_V_GEN)gpg --detach-sign --armor $@
 
-@PACKAGE@-@vers...@.tar.gz: _is-release-check check distcheck
-
-maintainer-prepare-release: _is-release-check all distcheck release-mail
+@PACKAGE@-@vers...@.tar.gz:
+	$(MAKE) _is-release-check
+	$(MAKE) check
+	$(MAKE) distcheck
+
+maintainer-prepare-release:
+	$(MAKE) _is-release-check
+	$(MAKE) all
+	$(MAKE) distcheck
+	$(MAKE) release-mail
 	git tag -s @PACKAGE@-@VERSION@ -m @PACKAGE@' '@VERSION@
 	gpg --detach-sign --armor @PACKAGE@-@vers...@.tar.gz
 
@@ -995,7 +1002,9 @@
 	rsync -vzP @PACKAGE@-@vers...@.tar.gz telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@vers...@.tar.gz
 	rsync -vzP @PACKAGE@-@vers...@.tar.gz.asc telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@vers...@.tar.gz.asc
 
-maintainer-make-release: maintainer-prepare-release maintainer-upload-release
+maintainer-make-release:
+	$(MAKE) maintainer-prepare-release
+	$(MAKE) maintainer-upload-release
 	@echo "Now:"
 	@echo " • bump the nano-version;"
 	@echo " • push the branch and tags upstream; and"
diff -Nur telepathy-mission-control-5-5.12.0/missing telepathy-mission-control-5-5.12.1/missing
diff -Nur telepathy-mission-control-5-5.12.0/NEWS telepathy-mission-control-5-5.12.1/NEWS
--- telepathy-mission-control-5-5.12.0/NEWS	2012-04-02 23:50:06.000000000 +0100
+++ telepathy-mission-control-5-5.12.1/NEWS	2012-07-11 11:55:01.000000000 +0100
@@ -1,3 +1,12 @@
+telepathy-mission-control 5.12.1 (2012-07-11)
+=============================================
+
+Fixes:
+
+• Stop using deprecated telepathy-glib symbols. (Jonny)
+• fdo#51842 - fix access to freed memory. (Xavier)
+• fix existing channel dispatching after using present/delegate. (Jonny)
+
 telepathy-mission-control 5.12.0 (2012-04-02)
 =============================================
 
diff -Nur telepathy-mission-control-5-5.12.0/.pc/0001-Revert-stop-using-deprecated-tp-glib-functions.patch/src/mcd-channel.c telepathy-mission-control-5-5.12.1/.pc/0001-Revert-stop-using-deprecated-tp-glib-functions.patch/src/mcd-channel.c
diff -Nur telepathy-mission-control-5-5.12.0/.pc/0001-Revert-stop-using-deprecated-tp-glib-functions.patch/src/mcd-connection.c telepathy-mission-control-5-5.12.1/.pc/0001-Revert-stop-using-deprecated-tp-glib-functions.patch/src/mcd-connection.c
diff -Nur telepathy-mission-control-5-5.12.0/.pc/0001-Revert-stop-using-deprecated-tp-glib-functions.patch/src/mcd-manager.c telepathy-mission-control-5-5.12.1/.pc/0001-Revert-stop-using-deprecated-tp-glib-functions.patch/src/mcd-manager.c
diff -Nur telepathy-mission-control-5-5.12.0/.pc/applied-patches telepathy-mission-control-5-5.12.1/.pc/applied-patches
diff -Nur telepathy-mission-control-5-5.12.0/src/mcd-account-manager-default.c telepathy-mission-control-5-5.12.1/src/mcd-account-manager-default.c
--- telepathy-mission-control-5-5.12.0/src/mcd-account-manager-default.c	2011-12-23 07:39:57.000000000 +0000
+++ telepathy-mission-control-5-5.12.1/src/mcd-account-manager-default.c	2012-07-11 11:09:34.000000000 +0100
@@ -77,7 +77,7 @@
     {
       /* flag the whole account as purged */
       gchar *removed = g_strdup (account);
-      g_hash_table_insert (amd->removed_accounts, removed, removed);
+      g_hash_table_replace (amd->removed_accounts, removed, removed);
     }
   else
     {
diff -Nur telepathy-mission-control-5-5.12.0/src/mcd-dispatcher.c telepathy-mission-control-5-5.12.1/src/mcd-dispatcher.c
--- telepathy-mission-control-5-5.12.0/src/mcd-dispatcher.c	2011-12-23 07:39:57.000000000 +0000
+++ telepathy-mission-control-5-5.12.1/src/mcd-dispatcher.c	2012-07-11 11:16:54.000000000 +0100
@@ -2584,6 +2584,13 @@
     DelegateChannelsCtx *ctx = to_delegate->ctx;
     McdClientProxy *clt_proxy = MCD_CLIENT_PROXY (client);
 
+    /* If the delegation succeeded, the channel has a new handler. If
+     * the delegation failed, the channel still has the old
+     * handler. Either way, the channel still has a handler, so it has
+     * been successfully dispatched (from 'handler invoked'). */
+    _mcd_channel_set_status (to_delegate->channel,
+        MCD_CHANNEL_STATUS_DISPATCHED);
+
     if (error != NULL)
       {
         DEBUG ("Handler refused delegated channels");
@@ -2615,6 +2622,9 @@
     McdClientProxy *client;
     GList *channels = NULL;
 
+    DEBUG ("%s",
+        mcd_channel_get_object_path (to_delegate->channel));
+
     if (g_queue_get_length (to_delegate->handlers) == 0)
       {
         GValueArray *v;
@@ -2641,13 +2651,17 @@
             g_strdup (mcd_channel_get_object_path (to_delegate->channel)),
             v);
 
+        DEBUG ("...but failed to delegate it: %s",
+            mcd_channel_get_object_path (to_delegate->channel),
+            to_delegate->error->message);
+
         delegation_done (to_delegate);
         return;
       }
 
     client = g_queue_pop_head (to_delegate->handlers);
 
-    DEBUG ("Try delegating channels to %s", _mcd_client_proxy_get_unique_name (
+    DEBUG ("...trying client %s", _mcd_client_proxy_get_unique_name (
         client));
 
     channels = g_list_prepend (channels, to_delegate->channel);
@@ -2721,6 +2735,8 @@
     guint i;
     GList *l;
 
+    DEBUG ("called");
+
     if (!check_preferred_handler (preferred_handler, &error))
         goto error;
 
@@ -2812,10 +2828,17 @@
 static void
 present_handle_channels_cb (TpClient *client,
     const GError *error,
-    gpointer user_data G_GNUC_UNUSED,
+    gpointer user_data,
     GObject *weak_object)
 {
     DBusGMethodInvocation *context = user_data;
+    McdChannel *mcd_channel = MCD_CHANNEL (weak_object);
+
+    /* Whether presenting the channel succeeded or failed, the
+     * channel's handler hasn't been altered, so it must be set back
+     * to the dispatched state (from 'handler invoked'). */
+    _mcd_channel_set_status (mcd_channel,
+        MCD_CHANNEL_STATUS_DISPATCHED);
 
     if (error != NULL)
       {
@@ -2884,7 +2907,7 @@
 
     _mcd_client_proxy_handle_channels (client, -1, channels,
         user_action_time, NULL, present_handle_channels_cb,
-        context, NULL, NULL);
+        context, NULL, G_OBJECT (mcd_channel));
 
     g_list_free (channels);
     return;
diff -Nur telepathy-mission-control-5-5.12.0/tests/twisted/dispatcher/redispatch-channels.py telepathy-mission-control-5-5.12.1/tests/twisted/dispatcher/redispatch-channels.py
--- telepathy-mission-control-5-5.12.0/tests/twisted/dispatcher/redispatch-channels.py	2011-12-23 07:39:57.000000000 +0000
+++ telepathy-mission-control-5-5.12.1/tests/twisted/dispatcher/redispatch-channels.py	2012-07-11 11:08:41.000000000 +0100
@@ -22,17 +22,49 @@
 import dbus.service
 
 from servicetest import call_async, assertEquals
-from mctest import exec_test, SimulatedClient, \
-        create_fakecm_account, enable_fakecm_account, SimulatedChannel, \
-        expect_client_setup
+from mctest import (
+    exec_test, SimulatedClient,
+    create_fakecm_account, enable_fakecm_account, SimulatedChannel,
+    expect_client_setup,
+    ChannelDispatcher, ChannelDispatchOperation, ChannelRequest)
 import constants as cs
 
-def test_delegate_channel(q, bus, mc, account, chan, empathy, empathy_bus, gs):
-    # Now gnome-shell wants to give the channel to another handle
-    gs_cd = bus.get_object(cs.CD, cs.CD_PATH)
-    gs_cd_iface = dbus.Interface(gs_cd, cs.CD)
+REQUEST = dbus.Dictionary({
+        cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+        cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+        cs.TARGET_ID: 'juliet',
+        }, signature='sv')
+
+def test_ensure(q, bus, account, conn, chan, expected_handler_path):
+    """Tests that a client Ensure-ing the channel causes HandleChannels to be
+    called on the current handler. (Previously, DelegateChannels() and
+    PresentChannel() both broke this.)"""
+    cd = ChannelDispatcher(bus)
+    call_async(q, cd, 'EnsureChannel', account.object_path, REQUEST, 0, '')
+    e = q.expect('dbus-return', method='EnsureChannel')
+
+    cr = ChannelRequest(bus, e.value[0])
+    cr.Proceed()
 
-    call_async(q, gs_cd_iface, 'DelegateChannels',
+    e = q.expect('dbus-method-call', interface=cs.CONN_IFACE_REQUESTS,
+        method='EnsureChannel',
+        path=conn.object_path, args=[REQUEST], handled=False)
+    q.dbus_return(e.message, False,
+        chan.object_path, chan.immutable, signature='boa{sv}')
+
+    e = q.expect('dbus-method-call',
+            interface=cs.HANDLER, method='HandleChannels',
+            handled=False)
+    assertEquals(expected_handler_path, e.path)
+    q.dbus_return(e.message, signature='')
+
+def test_delegate_channel(q, bus, mc, account, conn, chan, empathy, empathy_bus, gs):
+    # Test that re-Ensure-ing works before we start Delegating and Presenting.
+    test_ensure(q, bus, account, conn, chan, gs.object_path)
+
+    # Now gnome-shell wants to give the channel to another handler
+    gs_cd = ChannelDispatcher(bus)
+    call_async(q, gs_cd, 'DelegateChannels',
         [chan.object_path], 0, "")
 
     # Empathy is asked to handle the channel and accept
@@ -46,11 +78,14 @@
     e = q.expect('dbus-return', method='DelegateChannels')
     assertEquals(([chan.object_path], {}), e.value)
 
-    # Let's play ping-pong channel! Empathy give the channel back to GS
-    emp_cd = empathy_bus.get_object(cs.CD, cs.CD_PATH)
-    emp_cd_iface = dbus.Interface(emp_cd, cs.CD)
-
-    call_async(q, emp_cd_iface, 'DelegateChannels',
+    # Test that re-Ensure-ing the channel still works, and sends it to
+    # the right place.
+    test_ensure(q, bus, account, conn, chan, empathy.object_path)
+
+    # Let's play ping-pong with the channel! Empathy gives the channel
+    # back to GS
+    emp_cd = ChannelDispatcher(empathy_bus)
+    call_async(q, emp_cd, 'DelegateChannels',
         [chan.object_path], 0, "")
 
     # gnome-shell is asked to handle the channel and accept
@@ -64,8 +99,12 @@
     e = q.expect('dbus-return', method='DelegateChannels')
     assertEquals(([chan.object_path], {}), e.value)
 
+    # Test that re-Ensure-ing the channel sttill works, and sends it
+    # to the right place.
+    test_ensure(q, bus, account, conn, chan, gs.object_path)
+
     # gnome-shell wants to give it back, again
-    call_async(q, gs_cd_iface, 'DelegateChannels',
+    call_async(q, gs_cd, 'DelegateChannels',
         [chan.object_path], 0, "")
 
     # Empathy is asked to handle the channel but refuses
@@ -80,14 +119,18 @@
     e = q.expect('dbus-return', method='DelegateChannels')
     assertEquals(([], {chan.object_path: (cs.NOT_AVAILABLE, 'No thanks')}), e.value)
 
+    # Test that re-Ensure-ing the channel sttill works, and sends it
+    # to the right place.
+    test_ensure(q, bus, account, conn, chan, gs.object_path)
+
     # Empathy doesn't handle the channel atm but tries to delegates it
-    call_async(q, emp_cd_iface, 'DelegateChannels',
+    call_async(q, emp_cd, 'DelegateChannels',
         [chan.object_path], 0, "")
 
     q.expect('dbus-error', method='DelegateChannels', name=cs.NOT_YOURS)
 
     # gnome-shell which is handling the channel asks to re-ensure it
-    call_async(q, gs_cd_iface, 'PresentChannel',
+    call_async(q, gs_cd, 'PresentChannel',
         chan.object_path, 0)
 
     # gnome-shell is asked to re-handle the channel
@@ -101,7 +144,7 @@
     q.expect('dbus-return', method='PresentChannel')
 
     # empathy which is not handling the channel asks to re-ensure it
-    call_async(q, emp_cd_iface, 'PresentChannel',
+    call_async(q, emp_cd, 'PresentChannel',
         chan.object_path, 0)
 
     # gnome-shell is asked to re-handle the channel
@@ -114,6 +157,10 @@
 
     q.expect('dbus-return', method='PresentChannel')
 
+    # Test that re-Ensure-ing the channel *still* works, and sends it
+    # to the right place.
+    test_ensure(q, bus, account, conn, chan, gs.object_path)
+
     # Empathy crashes
     empathy.release_name()
 
@@ -124,7 +171,7 @@
             )
 
     # gnome-shell wants to delegate, but there is no other handler
-    call_async(q, gs_cd_iface, 'DelegateChannels',
+    call_async(q, gs_cd, 'DelegateChannels',
         [chan.object_path], 0, "")
 
     e = q.expect('dbus-return', method='DelegateChannels')
@@ -160,7 +207,7 @@
     # wait for MC to download the properties
     expect_client_setup(q, [empathy, gs])
 
-    cd = bus.get_object(cs.CD, cs.CD_PATH)
+    cd = ChannelDispatcher(bus)
 
     # incoming text channel
     channel_properties = dbus.Dictionary(text_fixed_properties,
@@ -184,13 +231,12 @@
 
     channels, cdo_path,props = e.args
 
-    cdo = bus.get_object(cs.CD, cdo_path)
-    cdo_iface = dbus.Interface(cdo, cs.CDO)
+    cdo = ChannelDispatchOperation(bus, cdo_path)
 
     q.dbus_return(e.message, signature='')
 
     # gnome-shell handles the channel itself first
-    call_async(q, cdo_iface, 'HandleWith',
+    call_async(q, cdo, 'HandleWith',
             cs.tp_name_prefix + '.Client.GnomeShell')
 
     e = q.expect('dbus-method-call',
@@ -201,7 +247,7 @@
     q.dbus_return(e.message, signature='')
 
     # test delegating an incoming channel
-    test_delegate_channel(q, bus, mc, account, chan, empathy, empathy_bus, gs)
+    test_delegate_channel(q, bus, mc, account, conn, chan, empathy, empathy_bus, gs)
 
     # Empathy is back
     empathy = SimulatedClient(q, empathy_bus, 'EmpathyChat',
@@ -210,27 +256,21 @@
     expect_client_setup(q, [empathy])
 
     # gnome-shell requests a channel for itself
-    request = dbus.Dictionary({
-            cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
-            cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
-            cs.TARGET_ID: 'juliet',
-            }, signature='sv')
-
     call_async(q, cd, 'CreateChannelWithHints',
-            account.object_path, request, 0,
+            account.object_path, REQUEST, 0,
             cs.tp_name_prefix + '.Client.GnomeShell',
-            {}, dbus_interface=cs.CD)
+            {})
     e = q.expect('dbus-return', method='CreateChannelWithHints')
 
-    cr = bus.get_object(cs.AM, e.value[0])
-    cr.Proceed(dbus_interface=cs.CR)
+    cr = ChannelRequest(bus, e.value[0])
+    cr.Proceed()
 
     e = q.expect('dbus-method-call', interface=cs.CONN_IFACE_REQUESTS,
         method='CreateChannel',
-        path=conn.object_path, args=[request], handled=False)
+        path=conn.object_path, args=[REQUEST], handled=False)
 
     # channel is created
-    chan = SimulatedChannel(conn, request)
+    chan = SimulatedChannel(conn, REQUEST)
 
     q.dbus_return(e.message,
         chan.object_path, chan.immutable, signature='oa{sv}')
@@ -245,7 +285,7 @@
     q.dbus_return(e.message, signature='')
 
     # test delegating an outgoing channel
-    test_delegate_channel(q, bus, mc, account, chan, empathy, empathy_bus, gs)
+    test_delegate_channel(q, bus, mc, account, conn, chan, empathy, empathy_bus, gs)
 
 if __name__ == '__main__':
     exec_test(test, {})
diff -Nur telepathy-mission-control-5-5.12.0/tests/twisted/mctest.py telepathy-mission-control-5-5.12.1/tests/twisted/mctest.py
--- telepathy-mission-control-5-5.12.0/tests/twisted/mctest.py	2012-04-02 23:43:52.000000000 +0100
+++ telepathy-mission-control-5-5.12.1/tests/twisted/mctest.py	2012-07-11 11:16:54.000000000 +0100
@@ -1087,6 +1087,16 @@
 
         servicetest.ProxyWrapper.__init__(self, bare_cd, cs.CD, {})
 
+class ChannelDispatchOperation(servicetest.ProxyWrapper):
+    def __init__(self, bus, path):
+        bare_cdo = bus.get_object(cs.CD, path)
+        servicetest.ProxyWrapper.__init__(self, bare_cdo, cs.CDO, {})
+
+class ChannelRequest(servicetest.ProxyWrapper):
+    def __init__(self, bus, path):
+        bare_cr = bus.get_object(cs.CD, path)
+        servicetest.ProxyWrapper.__init__(self, bare_cr, cs.CR, {})
+
 def connect_to_mc(q, bus, mc):
     account_manager = AccountManager(bus)
 
diff -Nur telepathy-mission-control-5-5.12.0/tools/telepathy.am telepathy-mission-control-5-5.12.1/tools/telepathy.am
--- telepathy-mission-control-5-5.12.0/tools/telepathy.am	2012-03-08 22:17:57.000000000 +0000
+++ telepathy-mission-control-5-5.12.1/tools/telepathy.am	2012-07-11 11:15:52.000000000 +0100
@@ -45,9 +45,16 @@
 %.tar.gz.asc: %.tar.gz
 	$(AM_V_GEN)gpg --detach-sign --armor $@
 
-@PACKAGE@-@vers...@.tar.gz: _is-release-check check distcheck
-
-maintainer-prepare-release: _is-release-check all distcheck release-mail
+@PACKAGE@-@vers...@.tar.gz:
+	$(MAKE) _is-release-check
+	$(MAKE) check
+	$(MAKE) distcheck
+
+maintainer-prepare-release:
+	$(MAKE) _is-release-check
+	$(MAKE) all
+	$(MAKE) distcheck
+	$(MAKE) release-mail
 	git tag -s @PACKAGE@-@VERSION@ -m @PACKAGE@' '@VERSION@
 	gpg --detach-sign --armor @PACKAGE@-@vers...@.tar.gz
 
@@ -67,7 +74,9 @@
 	rsync -vzP @PACKAGE@-@vers...@.tar.gz telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@vers...@.tar.gz
 	rsync -vzP @PACKAGE@-@vers...@.tar.gz.asc telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/@PACKAGE@/@PACKAGE@-@vers...@.tar.gz.asc
 
-maintainer-make-release: maintainer-prepare-release maintainer-upload-release
+maintainer-make-release:
+	$(MAKE) maintainer-prepare-release
+	$(MAKE) maintainer-upload-release
 	@echo "Now:"
 	@echo " • bump the nano-version;"
 	@echo " • push the branch and tags upstream; and"

Reply via email to