[empathy: 9/15] If we're asked to handle a channel twice, assume it's due to user action



commit 0e9bd3f5a6c19512f088993bfac8cec6aaabff7b
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Mon Oct 12 14:11:58 2009 -0400

    If we're asked to handle a channel twice, assume it's due to user action

 libempathy/empathy-dispatcher.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index 1742455..d7d3b9f 100644
--- a/libempathy/empathy-dispatcher.c
+++ b/libempathy/empathy-dispatcher.c
@@ -578,7 +578,17 @@ dispatcher_connection_new_channel (EmpathyDispatcher *self,
         }
     }
 
-  DEBUG ("New channel of type %s on %s", channel_type, object_path);
+  DEBUG ("%s channel of type %s on %s", incoming ? "incoming" : "outgoing",
+    channel_type, object_path);
+
+  if ((operation = g_hash_table_lookup (cd->dispatching_channels,
+      object_path)) != NULL)
+    {
+      /* This operation was already being dispatched, assume we got the channel
+       * again because something asked for it and approve it right away */
+      empathy_dispatch_operation_approve (operation);
+      return;
+    }
 
   if (properties == NULL)
     channel = tp_channel_new (connection, object_path, channel_type,
@@ -642,6 +652,10 @@ dispatcher_connection_new_channel (EmpathyDispatcher *self,
             }
         }
     }
+
+  if (g_hash_table_lookup (cd->dispatched_channels, object_path) != NULL)
+    empathy_dispatch_operation_approve (operation);
+
   dispatcher_start_dispatching (dispatcher, operation, cd);
 }
 
@@ -659,7 +673,6 @@ dispatcher_connection_new_channel_with_properties (
   gboolean requested;
   gboolean valid;
 
-
   channel_type = tp_asv_get_string (properties,
     TP_IFACE_CHANNEL ".ChannelType");
   if (channel_type == NULL)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]