aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-09-01 21:18:02 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-02-24 23:55:49 +0800
commit6c349195014a84995fa3283611eebd77f66046d3 (patch)
treed4cebf778441d9ef7cdf41139a784921351d778f /libempathy
parent6298cb37bb9a2d5ba87be44733136f6f373c9941 (diff)
downloadgsoc2013-empathy-6c349195014a84995fa3283611eebd77f66046d3.tar
gsoc2013-empathy-6c349195014a84995fa3283611eebd77f66046d3.tar.gz
gsoc2013-empathy-6c349195014a84995fa3283611eebd77f66046d3.tar.bz2
gsoc2013-empathy-6c349195014a84995fa3283611eebd77f66046d3.tar.lz
gsoc2013-empathy-6c349195014a84995fa3283611eebd77f66046d3.tar.xz
gsoc2013-empathy-6c349195014a84995fa3283611eebd77f66046d3.tar.zst
gsoc2013-empathy-6c349195014a84995fa3283611eebd77f66046d3.zip
Check if channels we requested satisfy requests
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-dispatcher.c69
1 files changed, 51 insertions, 18 deletions
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index 78e622137..937a16521 100644
--- a/libempathy/empathy-dispatcher.c
+++ b/libempathy/empathy-dispatcher.c
@@ -614,7 +614,8 @@ dispatcher_connection_new_channel (EmpathyDispatcher *self,
guint handle_type,
guint handle,
GHashTable *properties,
- gboolean incoming)
+ gboolean incoming,
+ const GPtrArray *requests_satisfied)
{
EmpathyDispatcherPriv *priv = GET_PRIV (self);
TpChannel *channel;
@@ -690,21 +691,51 @@ dispatcher_connection_new_channel (EmpathyDispatcher *self,
g_object_unref (channel);
- if (incoming)
+ if (!incoming && requests_satisfied != NULL)
{
- /* Request could either be by us or by a remote party. If there are no
- * outstanding requests for this channel type we can assume it's remote.
- * Otherwise we wait untill they are all satisfied */
- if (dispatcher_operation_can_start (self, operation, cd))
- dispatcher_start_dispatching (self, operation, cd);
- else
- g_hash_table_insert (cd->outstanding_channels,
- g_strdup (object_path), operation);
- }
- else
- {
- dispatcher_start_dispatching (self, operation, cd);
+ GList *l;
+ gboolean found = FALSE;
+
+ l = cd->outstanding_requests;
+
+ while (l != NULL)
+ {
+ DispatcherRequestData *d = (DispatcherRequestData *) l->data;
+ guint n;
+ const gchar *path;
+
+ l = g_list_next (l);
+ if (d->request == NULL)
+ continue;
+
+ if (d->operation != NULL)
+ continue;
+
+ path = tp_proxy_get_object_path (d->channel_request);
+ for (n = 0; n < requests_satisfied->len ; n++)
+ {
+ const gchar *p = g_ptr_array_index (requests_satisfied, n);
+ if (!tp_strdiff (p, path))
+ {
+ DEBUG ("Channel satified request %s"
+ "(already dispatched: %d)", p, found);
+ if (!found)
+ {
+ d->operation = operation;
+ found = TRUE;
+ continue;
+ }
+ else
+ {
+ GError err = { TP_ERRORS, TP_ERROR_NOT_YOURS,
+ "Not yours!" };
+ dispatcher_request_failed (dispatcher, d, &err);
+ }
+ }
+ }
+ }
}
+ dispatcher_start_dispatching (dispatcher, operation, cd);
}
static void
@@ -712,7 +743,8 @@ dispatcher_connection_new_channel_with_properties (
EmpathyDispatcher *self,
TpConnection *connection,
const gchar *object_path,
- GHashTable *properties)
+ GHashTable *properties,
+ const GPtrArray *requests_satisfied)
{
const gchar *channel_type;
guint handle_type;
@@ -756,7 +788,8 @@ dispatcher_connection_new_channel_with_properties (
}
dispatcher_connection_new_channel (self, connection,
- object_path, channel_type, handle_type, handle, properties, !requested);
+ object_path, channel_type, handle_type, handle, properties, !requested,
+ requests_satisfied);
}
static void
@@ -837,7 +870,7 @@ dispatcher_connection_got_all (TpProxy *proxy,
continue;
dispatcher_connection_new_channel_with_properties (self,
- TP_CONNECTION (proxy), object_path, props);
+ TP_CONNECTION (proxy), object_path, properties, NULL);
}
}
}
@@ -2228,7 +2261,7 @@ empathy_dispatcher_handle_channels (EmpathyHandler *handler,
properties = g_value_get_boxed (g_value_array_get_nth (arr, 1));
dispatcher_connection_new_channel_with_properties (self,
- connection, object_path, properties);
+ connection, object_path, properties, requests_satisfied);
}
return TRUE;