aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-ft-handler.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-07-01 23:05:32 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-08-11 15:43:56 +0800
commit0c52aee9583e68377b3c5da4d4f671761ae33e10 (patch)
tree83a3e707322c5c8bb5d6d97c9dc3d4c734adcd26 /libempathy/empathy-ft-handler.c
parentfaccecc4a1c1d2f08c98aa0c1b1418e70ce3990f (diff)
downloadgsoc2013-empathy-0c52aee9583e68377b3c5da4d4f671761ae33e10.tar
gsoc2013-empathy-0c52aee9583e68377b3c5da4d4f671761ae33e10.tar.gz
gsoc2013-empathy-0c52aee9583e68377b3c5da4d4f671761ae33e10.tar.bz2
gsoc2013-empathy-0c52aee9583e68377b3c5da4d4f671761ae33e10.tar.lz
gsoc2013-empathy-0c52aee9583e68377b3c5da4d4f671761ae33e10.tar.xz
gsoc2013-empathy-0c52aee9583e68377b3c5da4d4f671761ae33e10.tar.zst
gsoc2013-empathy-0c52aee9583e68377b3c5da4d4f671761ae33e10.zip
stop using Empathy's internal dispatcher to request FT channel
Diffstat (limited to 'libempathy/empathy-ft-handler.c')
-rw-r--r--libempathy/empathy-ft-handler.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index 9fd993115..13568cef9 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -23,6 +23,7 @@
#include <glib.h>
#include <glib/gi18n.h>
+#include <telepathy-glib/account-channel-request.h>
#include <telepathy-glib/util.h>
#include <telepathy-glib/dbus.h>
#include <telepathy-glib/interfaces.h>
@@ -711,55 +712,61 @@ ft_transfer_progress_callback (EmpathyTpFile *tp_file,
}
static void
-ft_handler_create_channel_cb (EmpathyDispatchOperation *operation,
- const GError *error,
+ft_handler_create_channel_cb (GObject *source,
+ GAsyncResult *result,
gpointer user_data)
{
EmpathyFTHandler *handler = user_data;
EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
- GError *my_error = (GError *) error;
+ GError *error = NULL;
+ TpChannel *channel = NULL;
DEBUG ("Dispatcher create channel CB");
- if (my_error == NULL)
- {
- g_cancellable_set_error_if_cancelled (priv->cancellable, &my_error);
- }
+ channel = tp_account_channel_request_create_and_handle_channel_finish (
+ TP_ACCOUNT_CHANNEL_REQUEST (source), result, NULL, &error);
- if (my_error != NULL)
- {
- emit_error_signal (handler, my_error);
+ if (channel == NULL)
+ DEBUG ("Failed to request FT channel: %s", error->message);
+ else
+ g_cancellable_set_error_if_cancelled (priv->cancellable, &error);
- if (my_error != error)
- g_clear_error (&my_error);
+ if (error != NULL)
+ {
+ emit_error_signal (handler, error);
- return;
+ g_error_free (error);
+ goto out;
}
- priv->tpfile = g_object_ref
- (empathy_dispatch_operation_get_channel_wrapper (operation));
+ priv->tpfile = empathy_tp_file_new (channel);
empathy_tp_file_offer (priv->tpfile, priv->gfile, priv->cancellable,
ft_transfer_progress_callback, handler,
ft_transfer_operation_callback, handler);
- empathy_dispatch_operation_claim (operation);
+out:
+ tp_clear_object (&channel);
}
static void
ft_handler_push_to_dispatcher (EmpathyFTHandler *handler)
{
- TpConnection *connection;
+ TpAccount *account;
EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
+ TpAccountChannelRequest *req;
DEBUG ("Pushing request to the dispatcher");
- connection = empathy_contact_get_connection (priv->contact);
+ account = empathy_contact_get_account (priv->contact);
+
+ req = tp_account_channel_request_new (account, priv->request,
+ EMPATHY_DISPATCHER_NON_USER_ACTION);
- /* I want to own a reference to the request, and destroy it later */
- empathy_dispatcher_create_channel (priv->dispatcher, connection,
- g_hash_table_ref (priv->request), EMPATHY_DISPATCHER_NON_USER_ACTION,
+ tp_account_channel_request_create_and_handle_channel_async (req, NULL,
ft_handler_create_channel_cb, handler);
+
+ g_object_unref (req);
}
static void