From 6298cb37bb9a2d5ba87be44733136f6f373c9941 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Tue, 1 Sep 2009 11:45:22 +0100 Subject: Request channels from the CD instead of the CM --- libempathy/empathy-dispatcher.c | 168 +++++++++++++++++++++++++++++++++------- 1 file changed, 141 insertions(+), 27 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 70f97f974..78e622137 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #include #include @@ -77,6 +79,9 @@ typedef struct /* (TpAccount *) => gulong * Signal handler ID of the "status-changed" signal */ GHashTable *status_changed_handlers; + + TpChannelDispatcher *channel_dispatcher; + TpDBusDaemon *dbus; } EmpathyDispatcherPriv; static GList * @@ -139,6 +144,8 @@ typedef struct EmpathyDispatcherRequestCb *cb; gpointer user_data; gpointer *request_data; + + TpChannelRequest *channel_request; } DispatcherRequestData; typedef struct @@ -187,6 +194,11 @@ empathy_dispatcher_call_create_or_ensure_channel ( EmpathyDispatcher *dispatcher, DispatcherRequestData *request_data); +static void +dispatcher_request_failed (EmpathyDispatcher *dispatcher, + DispatcherRequestData *request_data, + const GError *error); + static DispatchData * new_dispatch_data (TpChannel *channel, GObject *channel_wrapper) @@ -255,9 +267,13 @@ free_dispatcher_request_data (DispatcherRequestData *r) if (r->request != NULL) g_hash_table_unref (r->request); + if (r->pending_call != NULL) tp_proxy_pending_call_cancel (r->pending_call); + if (r->channel_request != NULL) + g_object_unref (r->channel_request); + g_slice_free (DispatcherRequestData, r); } @@ -1003,6 +1019,14 @@ dispatcher_dispose (GObject *object) g_hash_table_destroy (priv->connections); priv->connections = NULL; + if (priv->channel_dispatcher != NULL) + g_object_unref (priv->channel_dispatcher); + priv->channel_dispatcher = NULL; + + if (priv->dbus != NULL) + g_object_unref (priv->dbus); + priv->dbus = NULL; + G_OBJECT_CLASS (empathy_dispatcher_parent_class)->dispose (object); } @@ -1254,6 +1278,9 @@ empathy_dispatcher_init (EmpathyDispatcher *self) g_direct_equal); priv->status_changed_handlers = g_hash_table_new (g_direct_hash, g_direct_equal); + + priv->dbus = tp_dbus_daemon_dup (NULL); + priv->channel_dispatcher = tp_channel_dispatcher_new (priv->dbus); } EmpathyDispatcher * @@ -1622,40 +1649,119 @@ empathy_dispatcher_join_muc (TpConnection *connection, } static void -dispatcher_create_channel_cb (TpConnection *connect, - const gchar *object_path, - GHashTable *properties, - const GError *error, - gpointer user_data, - GObject *weak_object) +dispatcher_channel_request_failed_cb (TpChannelRequest *request, + const gchar *error, const gchar *message, + gpointer user_data, + GObject *weak_object) { DispatcherRequestData *request_data = (DispatcherRequestData *) user_data; EmpathyDispatcher *self = EMPATHY_DISPATCHER (request_data->dispatcher); + GError *err = NULL; request_data->pending_call = NULL; - dispatcher_connection_new_requested_channel (self, - request_data, object_path, properties, error); + DEBUG ("Request failed: %s - %s %s", + tp_proxy_get_object_path (request), + error, message); + + tp_proxy_dbus_error_to_gerror (TP_PROXY (request), + error, message, &err); + + dispatcher_request_failed (self, request_data, err); + + g_error_free (err); } static void -dispatcher_ensure_channel_cb (TpConnection *connect, - gboolean is_ours, - const gchar *object_path, - GHashTable *properties, - const GError *error, - gpointer user_data, - GObject *weak_object) +dispatcher_channel_request_succeeded_cb (TpChannelRequest *request, + gpointer user_data, + GObject *weak_object) { + EmpathyDispatcher *self = EMPATHY_DISPATCHER (weak_object); + EmpathyDispatcherPriv *priv = GET_PRIV (dispatcher); + DispatcherRequestData *request_data = (DispatcherRequestData *) user_data; + ConnectionData *conn_data; + + conn_data = g_hash_table_lookup (priv->connections, + request_data->connection); + + DEBUG ("Request succeeded: %s", tp_proxy_get_object_path (request)); + + /* When success gets called the internal request should have been satisfied, + * if it's still in outstanding_requests and doesn't have an operation + * assigned to it, the channel got handled by someone else.. */ + + if (g_list_find (conn_data->outstanding_requests, request_data) == NULL) + return; + + if (request_data->operation == NULL) + { + GError err = { TP_ERRORS, TP_ERROR_NOT_YOURS, "Not yours!" }; + dispatcher_request_failed (self, request_data, &err); + } +} + +static void +dispatcher_channel_request_proceed_cb (TpChannelRequest *request, + const GError *error, + gpointer user_data, + GObject *weak_object) +{ + EmpathyDispatcher *self = EMPATHY_DISPATCHER (weak_object); DispatcherRequestData *request_data = (DispatcherRequestData *) user_data; - EmpathyDispatcher *self = - EMPATHY_DISPATCHER (request_data->dispatcher); request_data->pending_call = NULL; - dispatcher_connection_new_requested_channel (self, - request_data, object_path, properties, error); + if (error != NULL) + dispatcher_request_failed (self, request_data, error); +} + +static void +dispatcher_create_channel_cb (TpChannelDispatcher *proxy, + const gchar *request_path, + const GError *error, + gpointer user_data, + GObject *weak_object) +{ + EmpathyDispatcher *self = EMPATHY_DISPATCHER (weak_object); + EmpathyDispatcherPriv *priv = GET_PRIV (dispatcher); + TpChannelRequest *request; + GError *err = NULL; + DispatcherRequestData *request_data = (DispatcherRequestData *) user_data; + + request_data->pending_call = NULL; + + if (error != NULL) + { + dispatcher_request_failed (self, request_data, error); + return; + } + + request = tp_channel_request_new (priv->dbus, request_path, NULL, NULL); + request_data->channel_request = request; + + if (tp_cli_channel_request_connect_to_failed (request, + dispatcher_channel_request_failed_cb, request_data, + NULL, G_OBJECT (self), &err) == NULL) + { + dispatcher_request_failed (dispatcher, request_data, err); + g_error_free (err); + return; + } + + if (tp_cli_channel_request_connect_to_succeeded (request, + dispatcher_channel_request_succeeded_cb, request_data, + NULL, G_OBJECT (self), &err) == NULL) + { + dispatcher_request_failed (self, request_data, err); + g_error_free (err); + return; + } + + request_data->pending_call = tp_cli_channel_request_call_proceed (request, + -1, dispatcher_channel_request_proceed_cb, + request_data, NULL, G_OBJECT (self)); } static void @@ -1663,21 +1769,29 @@ empathy_dispatcher_call_create_or_ensure_channel ( EmpathyDispatcher *self, DispatcherRequestData *request_data) { + EmpathyDispatcherPriv *priv = GET_PRIV (dispatcher); + TpAccount *account; + + account = empathy_get_account_for_connection (request_data->connection); + if (request_data->should_ensure) { request_data->pending_call = - tp_cli_connection_interface_requests_call_ensure_channel ( - request_data->connection, -1, - request_data->request, dispatcher_ensure_channel_cb, - request_data, NULL, NULL); + tp_cli_channel_dispatcher_call_ensure_channel ( + priv->channel_dispatcher, + -1, tp_proxy_get_object_path (TP_PROXY (account)), + request_data->request, 0, "", + dispatcher_create_channel_cb, request_data, NULL, NULL); } else { request_data->pending_call = - tp_cli_connection_interface_requests_call_create_channel ( - request_data->connection, -1, - request_data->request, dispatcher_create_channel_cb, - request_data, NULL, NULL); + tp_cli_channel_dispatcher_call_create_channel ( + priv->channel_dispatcher, + -1, tp_proxy_get_object_path (TP_PROXY (account)), + request_data->request, 0, "", + dispatcher_create_channel_cb, request_data, NULL, + G_OBJECT (dispatcher)); } } -- cgit v1.2.1 From 6c349195014a84995fa3283611eebd77f66046d3 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Tue, 1 Sep 2009 14:18:02 +0100 Subject: Check if channels we requested satisfy requests --- libempathy/empathy-dispatcher.c | 69 ++++++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 18 deletions(-) (limited to 'libempathy') 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; -- cgit v1.2.1 From 93aeafe92673b2e383fbfe3426c7ab918829d7ad Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Tue, 1 Sep 2009 14:18:42 +0100 Subject: Don't ever drop requested channels Before moving to the ChannelDispatcher we got channels either through the NewChannel(s) signal or as a result of requesting a channel from the CM. Now that we've moved to the ChannelDispatcher, we only get channels that we should handle through HandleChannels. So we shouldn't filter any of them. --- libempathy/empathy-dispatcher.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 937a16521..b199f0de5 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -650,17 +650,6 @@ dispatcher_connection_new_channel (EmpathyDispatcher *self, if (g_hash_table_lookup (cd->outstanding_channels, object_path) != NULL) return; - /* Only pick up non-requested text and file channels. For all other it - * doesn't make sense to handle it if we didn't request it. The same goes - * for channels we discovered by the Channels property or ListChannels */ - if (!incoming && tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TEXT) - && tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER)) - { - DEBUG ("Ignoring incoming channel of type %s on %s", - channel_type, object_path); - return; - } - for (i = 0 ; blacklist[i] != NULL; i++) { if (!tp_strdiff (channel_type, blacklist[i])) -- cgit v1.2.1 From 696f7bdae93846bdf809ae7e19be5f2ea9913fe6 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Tue, 1 Sep 2009 15:20:27 +0100 Subject: Remove dead code related to outstanding channels With the move to the ChannelDispatcher channels we've requested will either not be dispatched through HandleChannels (because we used the old way of directly requesting it on the MC) or will get passed after we've started the request and can thus be dispatched right away. The concept of oustanding channel is thus obsolete. --- libempathy/empathy-dispatcher.c | 98 +---------------------------------------- 1 file changed, 2 insertions(+), 96 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index b199f0de5..1742455d9 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -162,16 +162,6 @@ typedef struct /* ObjectPath -> EmpathyDispatchOperations */ GHashTable *dispatching_channels; - /* ObjectPath -> EmpathyDispatchOperations - * - * This holds channels which were announced with NewChannel while we have an - * outstanding channel request for a channel of this type. On the Requests - * interface, CreateChannel and EnsureChannel are guaranteed by the spec to - * return before NewChannels is emitted, but there was no guarantee of the - * ordering of RequestChannel vs. NewChannel. So if necessary, channels are - * held in limbo here until we know whether they were requested. - */ - GHashTable *outstanding_channels; /* List of DispatcherRequestData */ GList *outstanding_requests; /* List of requestable channel classes */ @@ -288,9 +278,6 @@ new_connection_data (void) cd->dispatching_channels = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); - cd->outstanding_channels = g_hash_table_new_full (g_str_hash, g_str_equal, - g_free, NULL); - return cd; } @@ -353,28 +340,6 @@ dispatcher_connection_invalidated_cb (TpConnection *connection, g_hash_table_remove (priv->connections, connection); } -static gboolean -dispatcher_operation_can_start (EmpathyDispatcher *self, - EmpathyDispatchOperation *operation, - ConnectionData *cd) -{ - GList *l; - const gchar *channel_type = - empathy_dispatch_operation_get_channel_type (operation); - - for (l = cd->outstanding_requests; l != NULL; l = g_list_next (l)) - { - DispatcherRequestData *d = (DispatcherRequestData *) l->data; - - if (d->operation == NULL && !tp_strdiff (d->channel_type, channel_type)) - { - return FALSE; - } - } - - return TRUE; -} - static void dispatch_operation_flush_requests (EmpathyDispatcher *self, EmpathyDispatchOperation *operation, @@ -419,7 +384,6 @@ dispatcher_channel_invalidated_cb (TpProxy *proxy, /* Channel went away... */ EmpathyDispatcherPriv *priv = GET_PRIV (self); TpConnection *connection; - EmpathyDispatchOperation *operation; ConnectionData *cd; const gchar *object_path; @@ -438,15 +402,6 @@ dispatcher_channel_invalidated_cb (TpProxy *proxy, g_hash_table_remove (cd->dispatching_channels, object_path); priv->channels = g_list_remove (priv->channels, proxy); - - operation = g_hash_table_lookup (cd->outstanding_channels, object_path); - if (operation != NULL) - { - GError error = { domain, code, message }; - dispatch_operation_flush_requests (self, operation, &error, cd); - g_hash_table_remove (cd->outstanding_channels, object_path); - g_object_unref (operation); - } } static void @@ -556,9 +511,6 @@ dispatcher_start_dispatching (EmpathyDispatcher *self, if (g_hash_table_lookup (cd->dispatching_channels, object_path) == NULL) { - g_assert (g_hash_table_lookup (cd->outstanding_channels, - object_path) == NULL); - g_hash_table_insert (cd->dispatching_channels, g_strdup (object_path), operation); @@ -586,26 +538,6 @@ dispatcher_start_dispatching (EmpathyDispatcher *self, } } -static void -dispatcher_flush_outstanding_operations (EmpathyDispatcher *self, - ConnectionData *cd) -{ - GHashTableIter iter; - gpointer value; - - g_hash_table_iter_init (&iter, cd->outstanding_channels); - while (g_hash_table_iter_next (&iter, NULL, &value)) - { - EmpathyDispatchOperation *operation = EMPATHY_DISPATCH_OPERATION (value); - - if (dispatcher_operation_can_start (self, operation, cd)) - { - g_hash_table_iter_remove (&iter); - dispatcher_start_dispatching (self, operation, cd); - } - } -} - static void dispatcher_connection_new_channel (EmpathyDispatcher *self, TpConnection *connection, @@ -636,20 +568,6 @@ dispatcher_connection_new_channel (EmpathyDispatcher *self, cd = g_hash_table_lookup (priv->connections, connection); - /* Don't bother with channels we have already dispatched or are dispatching - * currently. This can happen when NewChannel(s) is fired after - * RequestChannel/CreateChannel/EnsureChannel */ - if (g_hash_table_lookup (cd->dispatched_channels, object_path) != NULL) - return; - - if (g_hash_table_lookup (cd->dispatching_channels, object_path) != NULL) - return; - - /* Should never occur, but just in case a CM fires spurious NewChannel(s) - * signals */ - if (g_hash_table_lookup (cd->outstanding_channels, object_path) != NULL) - return; - for (i = 0 ; blacklist[i] != NULL; i++) { if (!tp_strdiff (channel_type, blacklist[i])) @@ -1380,16 +1298,10 @@ dispatcher_connection_new_requested_channel (EmpathyDispatcher *self, dispatcher_request_failed (self, request_data, error); - goto out; + return; } - operation = g_hash_table_lookup (conn_data->outstanding_channels, - object_path); - - if (operation != NULL) - g_hash_table_remove (conn_data->outstanding_channels, object_path); - else - operation = g_hash_table_lookup (conn_data->dispatching_channels, + operation = g_hash_table_lookup (conn_data->dispatching_channels, object_path); if (operation == NULL) @@ -1451,10 +1363,6 @@ dispatcher_connection_new_requested_channel (EmpathyDispatcher *self, conn_data); g_object_unref (operation); - -out: - dispatcher_flush_outstanding_operations (self, conn_data); - g_object_unref (self); } static void @@ -1623,8 +1531,6 @@ dispatcher_request_handles_cb (TpConnection *connection, request_data); free_dispatcher_request_data (request_data); - - dispatcher_flush_outstanding_operations (self, cd); return; } -- cgit v1.2.1 From 09a20a4289d896f18360be9020c984876d55a29b Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Tue, 1 Sep 2009 16:18:10 +0100 Subject: Replace tabs with spaces --- libempathy/empathy-handler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-handler.c b/libempathy/empathy-handler.c index ad4f415e0..715d5a8ac 100644 --- a/libempathy/empathy-handler.c +++ b/libempathy/empathy-handler.c @@ -167,8 +167,8 @@ handler_set_property (GObject *object, { case PROP_CHANNEL_FILTER: priv->filters = g_value_dup_boxed (value); - if (priv->filters == NULL) - priv->filters = g_ptr_array_new (); + if (priv->filters == NULL) + priv->filters = g_ptr_array_new (); break; case PROP_CAPABILITIES: priv->capabilities = g_value_dup_boxed (value); -- cgit v1.2.1 From 871cd053641dfb087db16e120c53c338cc442d4a Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Tue, 1 Sep 2009 16:19:54 +0100 Subject: Output the path before trying to register it --- libempathy/empathy-handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libempathy') diff --git a/libempathy/empathy-handler.c b/libempathy/empathy-handler.c index 715d5a8ac..c11227f68 100644 --- a/libempathy/empathy-handler.c +++ b/libempathy/empathy-handler.c @@ -102,12 +102,12 @@ handler_constructor (GType type, dbus = tp_dbus_daemon_dup (NULL); + DEBUG ("Registering at '%s'", object_path); g_assert (tp_dbus_daemon_request_name (dbus, priv->busname, TRUE, NULL)); dbus_g_connection_register_g_object (tp_get_bus (), object_path, obj); - DEBUG ("Registered at '%s'", object_path); g_free (object_path); g_object_unref (dbus); -- cgit v1.2.1 From eb8a6e36a56cbc3342368baf8190e0ef17e9a8f7 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 2 Sep 2009 18:29:32 +0100 Subject: Add a convenience function to get the busname of a handler --- libempathy/empathy-handler.c | 10 +++++++++- libempathy/empathy-handler.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'libempathy') diff --git a/libempathy/empathy-handler.c b/libempathy/empathy-handler.c index c11227f68..8cfa41942 100644 --- a/libempathy/empathy-handler.c +++ b/libempathy/empathy-handler.c @@ -102,7 +102,7 @@ handler_constructor (GType type, dbus = tp_dbus_daemon_dup (NULL); - DEBUG ("Registering at '%s'", object_path); + DEBUG ("Registering at %s, %s", priv->busname, object_path); g_assert (tp_dbus_daemon_request_name (dbus, priv->busname, TRUE, NULL)); dbus_g_connection_register_g_object (tp_get_bus (), @@ -374,6 +374,14 @@ error: g_error_free (error); } +const gchar * +empathy_handler_get_busname (EmpathyHandler *handler) +{ + EmpathyHandlerPriv *priv = GET_PRIV (handler); + + return priv->busname; +} + static void empathy_handler_client_handler_iface_init (gpointer g_iface, gpointer g_iface_data) diff --git a/libempathy/empathy-handler.h b/libempathy/empathy-handler.h index 684ec0cc9..f6b894ba0 100644 --- a/libempathy/empathy-handler.h +++ b/libempathy/empathy-handler.h @@ -62,6 +62,8 @@ EmpathyHandler * empathy_handler_new (const gchar *name, GPtrArray *filters, GStrv capabilities); +const gchar *empathy_handler_get_busname (EmpathyHandler *handler); + typedef gboolean (EmpathyHandlerHandleChannelsFunc) (EmpathyHandler *handler, const gchar *account_path, const gchar *connection_path, -- cgit v1.2.1 From eea99156d893167e6289906e4c237ad5210dbc99 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 2 Sep 2009 18:29:48 +0100 Subject: Add a debug message for when errors are signaled --- libempathy/empathy-ft-handler.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libempathy') diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index cd1d97ae0..ff3f9322a 100644 --- a/libempathy/empathy-ft-handler.c +++ b/libempathy/empathy-ft-handler.c @@ -619,6 +619,8 @@ emit_error_signal (EmpathyFTHandler *handler, { EmpathyFTHandlerPriv *priv = GET_PRIV (handler); + DEBUG ("Error in transfer: %s\n", error->message); + if (!g_cancellable_is_cancelled (priv->cancellable)) g_cancellable_cancel (priv->cancellable); -- cgit v1.2.1 From 0e9bd3f5a6c19512f088993bfac8cec6aaabff7b Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 12 Oct 2009 14:11:58 -0400 Subject: If we're asked to handle a channel twice, assume it's due to user action --- libempathy/empathy-dispatcher.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 1742455d9..d7d3b9f9a 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) -- cgit v1.2.1 From c98d650deadd48624a6dba026aa466ddc5b58626 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 12 Oct 2009 16:33:45 -0400 Subject: Set ourselves as the preferred handler if there is a callback --- libempathy/empathy-dispatcher.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index d7d3b9f9a..d6c790029 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -1712,16 +1712,20 @@ empathy_dispatcher_call_create_or_ensure_channel ( { EmpathyDispatcherPriv *priv = GET_PRIV (dispatcher); TpAccount *account; + const gchar *handler = ""; account = empathy_get_account_for_connection (request_data->connection); + if (request_data->cb) + handler = empathy_handler_get_busname (priv->handler); + if (request_data->should_ensure) { request_data->pending_call = tp_cli_channel_dispatcher_call_ensure_channel ( priv->channel_dispatcher, -1, tp_proxy_get_object_path (TP_PROXY (account)), - request_data->request, 0, "", + request_data->request, 0, handler, dispatcher_create_channel_cb, request_data, NULL, NULL); } else @@ -1730,7 +1734,7 @@ empathy_dispatcher_call_create_or_ensure_channel ( tp_cli_channel_dispatcher_call_create_channel ( priv->channel_dispatcher, -1, tp_proxy_get_object_path (TP_PROXY (account)), - request_data->request, 0, "", + request_data->request, 0, handler, dispatcher_create_channel_cb, request_data, NULL, G_OBJECT (dispatcher)); } -- cgit v1.2.1 From 05caf0ff7d093fa342fbff5e7c0e681750bf1523 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 24 Feb 2010 14:43:56 +0000 Subject: Small coding style fix --- libempathy/empathy-dispatcher.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libempathy') diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index d6c790029..74e8ecb6d 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -1591,7 +1591,8 @@ empathy_dispatcher_join_muc (TpConnection *connection, static void dispatcher_channel_request_failed_cb (TpChannelRequest *request, - const gchar *error, const gchar *message, + const gchar *error, + const gchar *message, gpointer user_data, GObject *weak_object) { -- cgit v1.2.1 From b05a5abcc6842be084aa12632b8ddd8d11dfa485 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 24 Feb 2010 14:44:09 +0000 Subject: Assert that the account exists --- libempathy/empathy-dispatcher.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libempathy') diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 74e8ecb6d..4227f9df5 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -1717,6 +1717,8 @@ empathy_dispatcher_call_create_or_ensure_channel ( account = empathy_get_account_for_connection (request_data->connection); + g_assert (account != NULL); + if (request_data->cb) handler = empathy_handler_get_busname (priv->handler); -- cgit v1.2.1 From 1e878d27797a90e0602180972f1727caed6c87eb Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 24 Feb 2010 15:55:14 +0000 Subject: Use a appropriate unique name for Empathy unique app --- libempathy/empathy-utils.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h index 859aed1e4..0fc6fc2a9 100644 --- a/libempathy/empathy-utils.h +++ b/libempathy/empathy-utils.h @@ -37,8 +37,6 @@ #define EMPATHY_GET_PRIV(obj,type) ((type##Priv *) ((type *) obj)->priv) #define EMP_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0') -#define EMPATHY_CLIENT_NAME "org.freedesktop.Telepathy.Client.Empathy" - G_BEGIN_DECLS void empathy_init (void); -- cgit v1.2.1 From 065307088d490e8f8bc4c04d3981b047c9fb408f Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Wed, 24 Feb 2010 16:50:54 +0000 Subject: Not using the weak object anymore, get the dispatcher request data from request data --- libempathy/empathy-dispatcher.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 4227f9df5..8577b6bb7 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -1666,11 +1666,11 @@ dispatcher_create_channel_cb (TpChannelDispatcher *proxy, gpointer user_data, GObject *weak_object) { - EmpathyDispatcher *self = EMPATHY_DISPATCHER (weak_object); + DispatcherRequestData *request_data = (DispatcherRequestData *) user_data; + EmpathyDispatcher *self = EMPATHY_DISPATCHER (request_data->dispatcher); EmpathyDispatcherPriv *priv = GET_PRIV (dispatcher); TpChannelRequest *request; GError *err = NULL; - DispatcherRequestData *request_data = (DispatcherRequestData *) user_data; request_data->pending_call = NULL; @@ -1687,7 +1687,7 @@ dispatcher_create_channel_cb (TpChannelDispatcher *proxy, dispatcher_channel_request_failed_cb, request_data, NULL, G_OBJECT (self), &err) == NULL) { - dispatcher_request_failed (dispatcher, request_data, err); + dispatcher_request_failed (self, request_data, err); g_error_free (err); return; } -- cgit v1.2.1