2 * empathy-ft-handler.c - Source for EmpathyFTHandler
3 * Copyright (C) 2009 Collabora Ltd.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
22 /* empathy-ft-handler.c */
24 #include <extensions/extensions.h>
26 #include <glib/gi18n.h>
27 #include <telepathy-glib/util.h>
29 #include "empathy-ft-handler.h"
30 #include "empathy-contact-factory.h"
31 #include "empathy-dispatcher.h"
32 #include "empathy-marshal.h"
33 #include "empathy-utils.h"
35 #define DEBUG_FLAG EMPATHY_DEBUG_FT
36 #include "empathy-debug.h"
38 G_DEFINE_TYPE (EmpathyFTHandler, empathy_ft_handler, G_TYPE_OBJECT)
40 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyFTHandler)
42 #define BUFFER_SIZE 4096
63 gboolean done_reading;
69 EmpathyFTHandler *handler;
73 EmpathyFTHandlerReadyCallback callback;
75 EmpathyFTHandler *handler;
82 EmpathyTpFile *tpfile;
83 GCancellable *cancellable;
85 /* request for the new transfer */
88 /* transfer properties */
89 EmpathyContact *contact;
94 guint64 transferred_bytes;
97 EmpFileHashType content_hash_type;
98 } EmpathyFTHandlerPriv;
100 static guint signals[LAST_SIGNAL] = { 0 };
103 static void schedule_hash_chunk (HashingData *hash_data);
105 /* GObject implementations */
107 do_get_property (GObject *object,
112 EmpathyFTHandlerPriv *priv = GET_PRIV (object);
117 g_value_set_object (value, priv->contact);
120 g_value_set_object (value, priv->gfile);
123 g_value_set_object (value, priv->tpfile);
126 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
131 do_set_property (GObject *object,
136 EmpathyFTHandlerPriv *priv = GET_PRIV (object);
141 priv->contact = g_value_dup_object (value);
144 priv->gfile = g_value_dup_object (value);
147 priv->tpfile = g_value_dup_object (value);
150 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
155 do_dispose (GObject *object)
157 EmpathyFTHandlerPriv *priv = GET_PRIV (object);
159 if (priv->dispose_run)
162 priv->dispose_run = TRUE;
165 g_object_unref (priv->contact);
166 priv->contact = NULL;
170 g_object_unref (priv->gfile);
175 empathy_tp_file_close (priv->tpfile);
176 g_object_unref (priv->tpfile);
180 if (priv->cancellable) {
181 g_object_unref (priv->cancellable);
182 priv->cancellable = NULL;
185 G_OBJECT_CLASS (empathy_ft_handler_parent_class)->dispose (object);
189 do_finalize (GObject *object)
191 G_OBJECT_CLASS (empathy_ft_handler_parent_class)->finalize (object);
195 empathy_ft_handler_class_init (EmpathyFTHandlerClass *klass)
197 GObjectClass *object_class = G_OBJECT_CLASS (klass);
198 GParamSpec *param_spec;
200 g_type_class_add_private (klass, sizeof (EmpathyFTHandlerPriv));
202 object_class->get_property = do_get_property;
203 object_class->set_property = do_set_property;
204 object_class->dispose = do_dispose;
205 object_class->finalize = do_finalize;
208 param_spec = g_param_spec_object ("contact",
209 "contact", "The remote contact",
210 EMPATHY_TYPE_CONTACT,
211 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
212 g_object_class_install_property (object_class, PROP_CONTACT, param_spec);
214 param_spec = g_param_spec_object ("gfile",
215 "gfile", "The GFile we're handling",
217 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
218 g_object_class_install_property (object_class, PROP_G_FILE, param_spec);
220 param_spec = g_param_spec_object ("tp-file",
221 "tp-file", "The file's channel wrapper",
222 EMPATHY_TYPE_TP_FILE,
223 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
224 g_object_class_install_property (object_class, PROP_TP_FILE, param_spec);
227 signals[TRANSFER_STARTED] =
228 g_signal_new ("transfer-started", G_TYPE_FROM_CLASS (klass),
229 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
230 g_cclosure_marshal_VOID__OBJECT,
232 1, EMPATHY_TYPE_TP_FILE);
234 signals[TRANSFER_DONE] =
235 g_signal_new ("transfer-done", G_TYPE_FROM_CLASS (klass),
236 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
237 g_cclosure_marshal_VOID__OBJECT,
239 1, EMPATHY_TYPE_TP_FILE);
241 signals[TRANSFER_ERROR] =
242 g_signal_new ("transfer-error", G_TYPE_FROM_CLASS (klass),
243 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
244 g_cclosure_marshal_VOID__POINTER,
248 signals[TRANSFER_PROGRESS] =
249 g_signal_new ("transfer-progress", G_TYPE_FROM_CLASS (klass),
250 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
251 _empathy_marshal_VOID__UINT64_UINT64,
253 2, G_TYPE_UINT64, G_TYPE_UINT64);
255 signals[HASHING_STARTED] =
256 g_signal_new ("hashing-started", G_TYPE_FROM_CLASS (klass),
257 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
258 g_cclosure_marshal_VOID__VOID,
261 signals[HASHING_PROGRESS] =
262 g_signal_new ("hashing-progress", G_TYPE_FROM_CLASS (klass),
263 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
264 _empathy_marshal_VOID__UINT64_UINT64,
266 2, G_TYPE_UINT64, G_TYPE_UINT64);
268 signals[HASHING_DONE] =
269 g_signal_new ("hashing-done", G_TYPE_FROM_CLASS (klass),
270 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
271 g_cclosure_marshal_VOID__VOID,
276 empathy_ft_handler_init (EmpathyFTHandler *self)
278 EmpathyFTHandlerPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
279 EMPATHY_TYPE_FT_HANDLER, EmpathyFTHandlerPriv);
284 /* private functions */
287 hash_data_free (HashingData *data)
289 if (data->buffer != NULL)
291 g_free (data->buffer);
295 if (data->stream != NULL)
297 g_object_unref (data->stream);
301 if (data->checksum != NULL)
303 g_checksum_free (data->checksum);
304 data->checksum = NULL;
307 if (data->error != NULL)
309 g_error_free (data->error);
312 if (data->handler != NULL)
314 g_object_unref (data->handler);
315 data->handler = NULL;
318 g_slice_free (HashingData, data);
322 ft_transfer_operation_callback (EmpathyTpFile *tp_file,
326 EmpathyFTHandler *handler = user_data;
329 g_signal_emit (handler, signals[TRANSFER_ERROR], 0, error);
331 g_signal_emit (handler, signals[TRANSFER_DONE], 0);
335 ft_transfer_progress_callback (EmpathyTpFile *tp_file,
336 guint64 transferred_bytes,
339 EmpathyFTHandler *handler = user_data;
340 EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
342 if (priv->transferred_bytes != transferred_bytes)
344 priv->transferred_bytes = transferred_bytes;
345 g_signal_emit (handler, signals[TRANSFER_PROGRESS], 0,
346 transferred_bytes, priv->total_bytes);
351 ft_handler_create_channel_cb (EmpathyDispatchOperation *operation,
355 EmpathyFTHandler *handler = user_data;
356 EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
358 DEBUG ("FT: dispatcher create channel CB");
362 /* TODO: error handling */
366 priv->tpfile = g_object_ref
367 (empathy_dispatch_operation_get_channel_wrapper (operation));
368 empathy_tp_file_offer (priv->tpfile, priv->gfile, priv->cancellable,
369 ft_transfer_progress_callback, handler,
370 ft_transfer_operation_callback, handler);
372 empathy_dispatch_operation_claim (operation);
376 ft_handler_push_to_dispatcher (EmpathyFTHandler *handler)
378 EmpathyDispatcher *dispatcher;
380 EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
382 DEBUG ("FT: pushing request to the dispatcher");
384 dispatcher = empathy_dispatcher_dup_singleton ();
385 account = empathy_contact_get_account (priv->contact);
387 empathy_dispatcher_create_channel (dispatcher, account, priv->request,
388 ft_handler_create_channel_cb, handler);
390 g_object_unref (dispatcher);
394 ft_handler_check_if_allowed (EmpathyFTHandler *handler)
396 EmpathyDispatcher *dispatcher;
397 EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
402 dispatcher = empathy_dispatcher_dup_singleton ();
403 account = empathy_contact_get_account (priv->contact);
405 allowed = empathy_dispatcher_find_channel_class (dispatcher, account,
406 EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, TP_HANDLE_TYPE_CONTACT);
408 if (!tp_strv_contains ((const gchar * const *) allowed,
409 TP_IFACE_CHANNEL ".TargetHandle"))
412 g_object_unref (dispatcher);
418 ft_handler_populate_outgoing_request (EmpathyFTHandler *handler)
420 guint contact_handle;
423 EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
425 request = priv->request = g_hash_table_new_full (g_str_hash, g_str_equal,
426 NULL, (GDestroyNotify) tp_g_value_slice_free);
428 contact_handle = empathy_contact_get_handle (priv->contact);
430 /* org.freedesktop.Telepathy.Channel.ChannelType */
431 value = tp_g_value_slice_new (G_TYPE_STRING);
432 g_value_set_string (value, EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER);
433 g_hash_table_insert (request, TP_IFACE_CHANNEL ".ChannelType", value);
435 /* org.freedesktop.Telepathy.Channel.TargetHandleType */
436 value = tp_g_value_slice_new (G_TYPE_UINT);
437 g_value_set_uint (value, TP_HANDLE_TYPE_CONTACT);
438 g_hash_table_insert (request, TP_IFACE_CHANNEL ".TargetHandleType", value);
440 /* org.freedesktop.Telepathy.Channel.TargetHandle */
441 value = tp_g_value_slice_new (G_TYPE_UINT);
442 g_value_set_uint (value, contact_handle);
443 g_hash_table_insert (request, TP_IFACE_CHANNEL ".TargetHandle", value);
445 /* org.freedesktop.Telepathy.Channel.Type.FileTransfer.ContentType */
446 value = tp_g_value_slice_new (G_TYPE_STRING);
447 g_value_set_string (value, priv->content_type);
448 g_hash_table_insert (request,
449 EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".ContentType", value);
451 /* org.freedesktop.Telepathy.Channel.Type.FileTransfer.Filename */
452 value = tp_g_value_slice_new (G_TYPE_STRING);
453 g_value_set_string (value, priv->filename);
454 g_hash_table_insert (request,
455 EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".Filename", value);
457 /* org.freedesktop.Telepathy.Channel.Type.FileTransfer.Size */
458 value = tp_g_value_slice_new (G_TYPE_UINT64);
459 g_value_set_uint64 (value, (guint64) priv->total_bytes);
460 g_hash_table_insert (request,
461 EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".Size", value);
463 /* org.freedesktop.Telepathy.Channel.Type.FileTransfer.Date */
464 value = tp_g_value_slice_new (G_TYPE_UINT64);
465 g_value_set_uint64 (value, (guint64) priv->mtime);
466 g_hash_table_insert (request,
467 EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".Date", value);
471 hash_job_async_close_stream_cb (GObject *source,
475 HashingData *hash_data = user_data;
476 EmpathyFTHandler *handler = hash_data->handler;
477 EmpathyFTHandlerPriv *priv;
478 GError *error = NULL;
481 DEBUG ("FT: closing stream after hashing.");
483 priv = GET_PRIV (handler);
485 /* if we're here we for sure have done reading, check if we stopped due
488 g_input_stream_close_finish (hash_data->stream, res, &error);
491 if (hash_data->error != NULL)
493 /* if we already stopped due to an error, probably we're completely
494 * hosed for some reason. just return the first read error
497 g_clear_error (&error);
498 error = hash_data->error;
504 if (hash_data->error != NULL)
506 error = hash_data->error;
510 /* set the checksum in the request */
512 DEBUG ("FT: got file hash %s", g_checksum_get_string (hash_data->checksum));
514 /* org.freedesktop.Telepathy.Channel.Type.FileTransfer.ContentHash */
515 value = tp_g_value_slice_new (G_TYPE_STRING);
516 g_value_set_string (value, g_checksum_get_string (hash_data->checksum));
517 g_hash_table_insert (priv->request,
518 EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".ContentHash", value);
521 hash_data_free (hash_data);
525 g_signal_emit (handler, signals[TRANSFER_ERROR], 0, error);
526 g_clear_error (&error);
530 g_signal_emit (handler, signals[HASHING_DONE], 0);
532 /* the request is complete now, push it to the dispatcher */
533 ft_handler_push_to_dispatcher (handler);
538 hash_job_async_read_cb (GObject *source,
542 HashingData *hash_data = user_data;
544 GError *error = NULL;
546 DEBUG ("FT: reading a chunk for hashing.");
548 bytes_read = g_input_stream_read_finish (hash_data->stream, res, &error);
551 hash_data->error = error;
552 hash_data->done_reading = TRUE;
556 hash_data->total_read += bytes_read;
558 /* we now have the chunk */
561 hash_data->done_reading = TRUE;
566 g_checksum_update (hash_data->checksum, hash_data->buffer, bytes_read);
567 g_signal_emit (hash_data->handler, signals[HASHING_PROGRESS], 0,
568 (guint64) hash_data->total_read, (guint64) hash_data->total_bytes);
572 g_free (hash_data->buffer);
573 hash_data->buffer = NULL;
575 schedule_hash_chunk (hash_data);
579 schedule_hash_chunk (HashingData *hash_data)
581 EmpathyFTHandlerPriv *priv;
583 priv = GET_PRIV (hash_data->handler);
585 if (hash_data->done_reading)
587 g_input_stream_close_async (hash_data->stream, G_PRIORITY_DEFAULT,
588 priv->cancellable, hash_job_async_close_stream_cb, hash_data);
592 if (hash_data->buffer == NULL)
593 hash_data->buffer = g_malloc0 (BUFFER_SIZE);
595 g_input_stream_read_async (hash_data->stream, hash_data->buffer,
596 BUFFER_SIZE, G_PRIORITY_DEFAULT, priv->cancellable,
597 hash_job_async_read_cb, hash_data);
602 ft_handler_read_async_cb (GObject *source,
606 GFileInputStream *stream;
607 GError *error = NULL;
608 HashingData *hash_data;
610 EmpathyFTHandler *handler = user_data;
611 EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
613 DEBUG ("FT: GFile read async CB.");
615 stream = g_file_read_finish (priv->gfile, res, &error);
618 g_signal_emit (handler, signals[TRANSFER_ERROR], 0, error);
619 g_clear_error (&error);
624 hash_data = g_slice_new0 (HashingData);
625 hash_data->stream = G_INPUT_STREAM (stream);
626 hash_data->done_reading = FALSE;
627 hash_data->total_bytes = priv->total_bytes;
628 hash_data->handler = g_object_ref (handler);
629 /* FIXME: should look at the CM capabilities before setting the
632 hash_data->checksum = g_checksum_new (G_CHECKSUM_MD5);
634 /* org.freedesktop.Telepathy.Channel.Type.FileTransfer.ContentHashType */
635 value = tp_g_value_slice_new (G_TYPE_UINT);
636 g_value_set_uint (value, EMP_FILE_HASH_TYPE_MD5);
637 g_hash_table_insert (priv->request,
638 EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER ".ContentHashType", value);
640 g_signal_emit (handler, signals[HASHING_STARTED], 0);
642 schedule_hash_chunk (hash_data);
646 ft_handler_complete_request (EmpathyFTHandler *handler)
648 EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
649 GError *myerr = NULL;
651 /* check if FT is allowed before firing up the I/O machinery */
652 if (!ft_handler_check_if_allowed (handler))
654 g_set_error_literal (&myerr, EMPATHY_FT_ERROR_QUARK,
655 EMPATHY_FT_ERROR_NOT_SUPPORTED,
656 _("File transfer not supported by remote contact"));
658 g_signal_emit (handler, signals[TRANSFER_ERROR], 0, myerr);
659 g_clear_error (&myerr);
664 /* populate the request table with all the known properties */
665 ft_handler_populate_outgoing_request (handler);
667 /* now start hashing the file */
668 g_file_read_async (priv->gfile, G_PRIORITY_DEFAULT,
669 priv->cancellable, ft_handler_read_async_cb, handler);
673 callbacks_data_free (gpointer user_data)
675 CallbacksData *data = user_data;
678 g_object_unref (data->handler);
680 g_slice_free (CallbacksData, data);
684 ft_handler_gfile_ready_cb (GObject *source,
686 CallbacksData *cb_data)
689 GError *error = NULL;
691 EmpathyFTHandlerPriv *priv = GET_PRIV (cb_data->handler);
693 DEBUG ("FT: got GFileInfo.");
695 info = g_file_query_info_finish (priv->gfile, res, &error);
700 priv->content_type = g_strdup (g_file_info_get_content_type (info));
701 priv->filename = g_strdup (g_file_info_get_display_name (info));
702 priv->total_bytes = g_file_info_get_size (info);
703 g_file_info_get_modification_time (info, &mtime);
704 priv->mtime = mtime.tv_sec;
705 priv->transferred_bytes = 0;
706 priv->description = NULL;
708 g_object_unref (info);
713 cb_data->callback (cb_data->handler, NULL, cb_data->user_data);
717 cb_data->callback (NULL, error, cb_data->user_data);
718 g_error_free (error);
719 g_object_unref (cb_data->handler);
722 callbacks_data_free (cb_data);
726 ft_handler_contact_ready_cb (EmpathyContact *contact,
729 GObject *weak_object)
731 CallbacksData *cb_data = user_data;
732 EmpathyFTHandlerPriv *priv = GET_PRIV (weak_object);
734 g_assert (priv->contact != NULL);
735 g_assert (priv->gfile != NULL);
737 DEBUG ("FT: contact is ready.");
739 /* start collecting info about the file */
740 g_file_query_info_async (priv->gfile,
741 G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
742 G_FILE_ATTRIBUTE_STANDARD_SIZE ","
743 G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE ","
744 G_FILE_ATTRIBUTE_TIME_MODIFIED,
745 G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT,
746 NULL, (GAsyncReadyCallback) ft_handler_gfile_ready_cb,
751 channel_get_all_properties_cb (TpProxy *proxy,
752 GHashTable *properties,
755 GObject *weak_object)
757 CallbacksData *cb_data = user_data;
758 EmpathyFTHandler *handler = EMPATHY_FT_HANDLER (weak_object);
759 EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
760 EmpathyContactFactory *c_factory;
766 cb_data->callback (NULL, (GError *) error, cb_data->user_data);
767 g_object_unref (handler);
771 priv->total_bytes = g_value_get_uint64 (
772 g_hash_table_lookup (properties, "Size"));
774 priv->transferred_bytes = g_value_get_uint64 (
775 g_hash_table_lookup (properties, "TransferredBytes"));
777 priv->filename = g_value_dup_string (
778 g_hash_table_lookup (properties, "Filename"));
780 priv->content_hash = g_value_dup_string (
781 g_hash_table_lookup (properties, "ContentHash"));
783 priv->content_hash_type = g_value_get_uint (
784 g_hash_table_lookup (properties, "ContentHashType"));
786 priv->content_type = g_value_dup_string (
787 g_hash_table_lookup (properties, "ContentType"));
789 priv->description = g_value_dup_string (
790 g_hash_table_lookup (properties, "Description"));
792 g_hash_table_destroy (properties);
794 c_factory = empathy_contact_factory_dup_singleton ();
795 account = empathy_channel_get_account (TP_CHANNEL (proxy));
796 c_handle = tp_channel_get_handle (TP_CHANNEL (proxy), NULL);
797 priv->contact = empathy_contact_factory_get_from_handle
798 (c_factory, account,c_handle);
800 g_object_unref (c_factory);
801 g_object_unref (account);
803 cb_data->callback (handler, NULL, cb_data->user_data);
809 empathy_ft_handler_new_outgoing (EmpathyContact *contact,
811 EmpathyFTHandlerReadyCallback callback,
814 EmpathyFTHandler *handler;
816 EmpathyFTHandlerPriv *priv;
818 g_return_if_fail (EMPATHY_IS_CONTACT (contact));
819 g_return_if_fail (G_IS_FILE (source));
821 handler = g_object_new (EMPATHY_TYPE_FT_HANDLER,
822 "contact", contact, "gfile", source, NULL);
824 priv = GET_PRIV (handler);
826 data = g_slice_new0 (CallbacksData);
827 data->callback = callback;
828 data->user_data = user_data;
829 data->handler = g_object_ref (handler);
831 empathy_contact_call_when_ready (priv->contact,
832 EMPATHY_CONTACT_READY_HANDLE,
833 ft_handler_contact_ready_cb, data, NULL, G_OBJECT (handler));
837 empathy_ft_handler_new_incoming (EmpathyTpFile *tp_file,
839 EmpathyFTHandlerReadyCallback callback,
842 EmpathyFTHandler *handler;
846 g_return_if_fail (EMPATHY_IS_TP_FILE (tp_file));
847 g_return_if_fail (G_IS_FILE (destination));
849 handler = g_object_new (EMPATHY_TYPE_FT_HANDLER,
850 "tp-file", tp_file, "gfile", destination, NULL);
852 g_object_get (tp_file, "channel", &channel, NULL);
854 data = g_slice_new0 (CallbacksData);
855 data->callback = callback;
856 data->user_data = user_data;
857 data->handler = g_object_ref (handler);
859 tp_cli_dbus_properties_call_get_all (channel,
860 -1, EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER,
861 channel_get_all_properties_cb, data, callbacks_data_free, G_OBJECT (handler));
865 empathy_ft_handler_start_transfer (EmpathyFTHandler *handler,
866 GCancellable *cancellable)
868 EmpathyFTHandlerPriv *priv;
870 g_return_if_fail (EMPATHY_IS_FT_HANDLER (handler));
872 priv = GET_PRIV (handler);
873 priv->cancellable = g_object_ref (cancellable);
875 if (priv->tpfile == NULL)
877 ft_handler_complete_request (handler);
881 /* TODO: add support for resume. */
882 empathy_tp_file_accept (priv->tpfile, 0, priv->gfile, priv->cancellable,
883 ft_transfer_progress_callback, handler,
884 ft_transfer_operation_callback, handler);