aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy/empathy-dispatcher.c39
-rw-r--r--src/empathy-event-manager.c23
2 files changed, 48 insertions, 14 deletions
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index bde8b6a1a..a0d5fbc3d 100644
--- a/libempathy/empathy-dispatcher.c
+++ b/libempathy/empathy-dispatcher.c
@@ -903,6 +903,22 @@ empathy_dispatcher_dup_singleton (void)
}
static void
+dispatcher_request_failed (EmpathyDispatcher *dispatcher,
+ DispatcherRequestData *request_data, const GError *error)
+{
+ EmpathyDispatcherPriv *priv = GET_PRIV (dispatcher);
+ ConnectionData *conn_data;
+
+ conn_data = g_hash_table_lookup (priv->connections, request_data->connection);
+ if (request_data->cb != NULL)
+ request_data->cb (NULL, error, request_data->user_data);
+
+ conn_data->outstanding_requests =
+ g_list_remove (conn_data->outstanding_requests, request_data);
+ free_dispatcher_request_data (request_data);
+}
+
+static void
dispatcher_connection_new_requested_channel (EmpathyDispatcher *dispatcher,
DispatcherRequestData *request_data, const gchar *object_path,
GHashTable *properties, const GError *error)
@@ -918,12 +934,7 @@ dispatcher_connection_new_requested_channel (EmpathyDispatcher *dispatcher,
{
DEBUG ("Channel request failed: %s", error->message);
- if (request_data->cb != NULL)
- request_data->cb (NULL, error, request_data->user_data);
-
- conn_data->outstanding_requests =
- g_list_remove (conn_data->outstanding_requests, request_data);
- free_dispatcher_request_data (request_data);
+ dispatcher_request_failed (dispatcher, request_data, error);
goto out;
}
@@ -1043,7 +1054,8 @@ empathy_dispatcher_call_with_contact ( EmpathyContact *contact,
static void
-dispatcher_chat_with_contact_cb (EmpathyContact *contact, gpointer user_data)
+dispatcher_chat_with_contact_cb (EmpathyContact *contact,
+ const GError *error, gpointer user_data, GObject *object)
{
DispatcherRequestData *request_data = (DispatcherRequestData *) user_data;
@@ -1080,7 +1092,7 @@ empathy_dispatcher_chat_with_contact (EmpathyContact *contact,
empathy_contact_call_when_ready (contact,
EMPATHY_CONTACT_READY_HANDLE, dispatcher_chat_with_contact_cb,
- request_data);
+ request_data, NULL, G_OBJECT (dispatcher));
g_object_unref (dispatcher);
}
@@ -1184,13 +1196,20 @@ dispatcher_create_channel_cb (TpConnection *connect,
static void
dispatcher_create_channel_with_contact_cb (EmpathyContact *contact,
- gpointer user_data)
+ const GError *error, gpointer user_data, GObject *object)
{
DispatcherRequestData *request_data = (DispatcherRequestData *) user_data;
GValue *target_handle;
g_assert (request_data->request);
+ if (error != NULL)
+ {
+ dispatcher_request_failed (request_data->dispatcher,
+ request_data, error);
+ return;
+ }
+
request_data->handle = empathy_contact_get_handle (contact);
target_handle = tp_g_value_slice_new (G_TYPE_UINT);
@@ -1265,7 +1284,7 @@ empathy_dispatcher_send_file_to_contact (EmpathyContact *contact,
empathy_contact_call_when_ready (contact,
EMPATHY_CONTACT_READY_HANDLE, dispatcher_create_channel_with_contact_cb,
- request_data);
+ request_data, NULL, G_OBJECT (dispatcher));
g_object_unref (dispatcher);
}
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index 3c7541c82..1855027b4 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -238,11 +238,18 @@ event_manager_operation_claimed_cb (EmpathyDispatchOperation *operation,
static void
event_manager_media_channel_got_name_cb (EmpathyContact *contact,
- gpointer user_data)
+ const GError *error, gpointer user_data, GObject *object)
{
EventManagerApproval *approval = user_data;
gchar *msg;
+ if (error != NULL)
+ {
+ /* FIXME just returning assuming the operation will be invalidated as
+ * well */
+ return;
+ }
+
msg = g_strdup_printf (_("Incoming call from %s"),
empathy_contact_get_name (contact));
@@ -258,7 +265,7 @@ event_manager_media_channel_got_contact (EventManagerApproval *approval)
{
empathy_contact_call_when_ready (approval->contact,
EMPATHY_CONTACT_READY_NAME, event_manager_media_channel_got_name_cb,
- approval);
+ approval, NULL, G_OBJECT (approval->manager));
}
static void
@@ -331,14 +338,22 @@ event_manager_tube_dispatch_ability_cb (GObject *object,
static void
event_manager_tube_got_contact_name_cb (EmpathyContact *contact,
- gpointer user_data)
+ const GError *error, gpointer user_data, GObject *object)
{
EventManagerApproval *approval = (EventManagerApproval *)user_data;
EmpathyTubeDispatchAbility dispatchability;
+ if (error != NULL)
+ {
+ /* FIXME?, we assume that the operation gets invalidated as well (if it
+ * didn't already */
+ return;
+ }
+
dispatchability = empathy_tube_dispatch_is_dispatchable
(approval->tube_dispatch);
+
switch (dispatchability)
{
case EMPATHY_TUBE_DISPATCHABILITY_UNKNOWN:
@@ -457,7 +472,7 @@ event_manager_approve_channel_cb (EmpathyDispatcher *dispatcher,
empathy_contact_call_when_ready (contact,
EMPATHY_CONTACT_READY_NAME, event_manager_tube_got_contact_name_cb,
- approval);
+ approval, NULL, G_OBJECT (manager));
g_object_unref (factory);
g_object_unref (account);