]> git.0d.be Git - empathy.git/commitdiff
Handle re-dispatching channels in approving state
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Fri, 20 Feb 2009 22:51:11 +0000 (22:51 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Fri, 20 Feb 2009 22:51:11 +0000 (22:51 +0000)
when a channel is in approving state and the user does a request which turns
out to be satisfied by that channel it automagically gets approved. Correctly
cope with this and don't try to start dispatching for it again. Fixes bug

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
svn path=/trunk/; revision=2524

libempathy/empathy-dispatcher.c

index 38eb71a9eb53f688f6256e4fab2091591f32a7ff..b3fd6a8a208d47a1666849dc7b17da760772e897 100644 (file)
@@ -1120,11 +1120,21 @@ dispatcher_connection_new_requested_channel (EmpathyDispatcher *dispatcher,
 
   request_data->operation = operation;
 
-  /* (pre)-approve this right away as we requested it */
+  /* (pre)-approve this right away as we requested it
+   * This might cause the channel to be claimed, in which case the operation
+   * will disappear. So ref it, and check the status before starting the
+   * dispatching */
+
+  g_object_ref (operation);
   empathy_dispatch_operation_approve (operation);
 
-  dispatcher_start_dispatching (request_data->dispatcher, operation,
-        conn_data);
+   if (empathy_dispatch_operation_get_status (operation) <
+     EMPATHY_DISPATCHER_OPERATION_STATE_APPROVING)
+      dispatcher_start_dispatching (request_data->dispatcher, operation,
+          conn_data);
+
+  g_object_unref (operation);
+
 out:
   dispatcher_flush_outstanding_operations (request_data->dispatcher,
     conn_data);