summaryrefslogtreecommitdiff
path: root/telepathy-glib/file-transfer-channel.c
blob: f5bbf1ef9d7aca73f5597f9644f13f5e15159a01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
/*
 * file-transfer-channel.h - high level API for Chan.I.FileTransfer
 *
 * Copyright (C) 2010-2011 Morten Mjelva <morten.mjelva@gmail.com>
 * Copyright (C) 2010-2011 Collabora Ltd. <http://www.collabora.co.uk/>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

/**
 * SECTION:file-transfer-channel
 * @title: TpFileTransferChannel
 * @short_description: proxy object for a file transfer channel
 *
 * #TpFileTransferChannel is a sub-class of #TpChannel providing convenient
 * API to send and receive files.
 */

/**
 * TpFileTransferChannel:
 *
 * Data structure representing a #TpFileTransferChannel.
 *
 * Since: 0.15.UNRELEASED
 */

/**
 * TpFileTransferChannelClass:
 *
 * The class of a #TpFileTransferChannel.
 *
 * Since: 0.15.UNRELEASED
 */

#include <config.h>

#include "telepathy-glib/file-transfer-channel.h"

#include <telepathy-glib/dbus.h>
#include <telepathy-glib/gnio-util.h>
#include <telepathy-glib/gtypes.h>
#include <telepathy-glib/interfaces.h>
#include <telepathy-glib/proxy-subclass.h>
#include <telepathy-glib/proxy-internal.h>
#include <telepathy-glib/util-internal.h>
#include <telepathy-glib/util.h>

#define DEBUG_FLAG TP_DEBUG_CHANNEL
#include "telepathy-glib/automatic-client-factory-internal.h"
#include "telepathy-glib/debug-internal.h"
#include "_gen/signals-marshal.h"

#include <stdio.h>
#include <glib.h>
#include <glib/gstdio.h>

#ifdef HAVE_GIO_UNIX
#include <gio/gunixsocketaddress.h>
#include <gio/gunixconnection.h>
#endif /* HAVE_GIO_UNIX */

G_DEFINE_TYPE (TpFileTransferChannel, tp_file_transfer_channel, TP_TYPE_CHANNEL)

struct _TpFileTransferChannelPrivate
{
    /* Exposed properties */
    const gchar *mime_type;
    GDateTime *date;
    const gchar *description;
    const gchar *filename;
    guint64 size;
    guint64 transferred_bytes;

    /* Hidden properties */
    /* borrowed from the immutable properties GHashTable */
    GHashTable *available_socket_types;
    const gchar *content_hash;
    TpFileHashType content_hash_type;
    goffset initial_offset;
    TpFileTransferState state;
    TpFileTransferStateChangeReason state_reason;
};

enum /* properties */
{
  PROP_MIME_TYPE = 1,
  PROP_DATE,
  PROP_DESCRIPTION,
  PROP_FILENAME,
  PROP_SIZE,
  PROP_TRANSFERRED_BYTES,
  PROP_FILE,
  N_PROPS
};

/* Callbacks */

static void
tp_file_transfer_channel_state_changed_cb (TpChannel *proxy,
    guint state,
    guint reason,
    gpointer user_data,
    GObject *weak_object)
{
  TpFileTransferChannel *self = (TpFileTransferChannel *) proxy;

  self->priv->state = state;
  self->priv->state_reason = reason;
}

static void
tp_file_transfer_channel_initial_offset_defined_cb (TpChannel *proxy,
    guint64 initial_offset,
    gpointer user_data,
    GObject *weak_object)
{
  TpFileTransferChannel *self = (TpFileTransferChannel *) proxy;

  self->priv->initial_offset = initial_offset;
}

static void
tp_file_transfer_channel_transferred_bytes_changed_cb (TpChannel *proxy,
    guint64 count,
    gpointer user_data,
    GObject *weak_object)
{
  TpFileTransferChannel *self = (TpFileTransferChannel *) proxy;

  self->priv->transferred_bytes = count;
  g_object_notify (G_OBJECT (self), "transferred-bytes");
}

static void
tp_file_transfer_channel_prepare_core_cb (TpProxy *proxy,
    GHashTable *properties,
    const GError *error,
    gpointer user_data,
    GObject *weak_object)
{
  TpFileTransferChannel *self = (TpFileTransferChannel *) proxy;
  GSimpleAsyncResult *result = user_data;
  gboolean valid;

  if (error != NULL)
    {
      g_simple_async_result_set_from_error (result, error);
      goto out;
    }

  self->priv->state = tp_asv_get_uint32 (properties, "State", &valid);
  if (!valid)
    {
      DEBUG ("Channel %s doesn't have FileTransfer.State property",
          tp_proxy_get_object_path (self));
    }

  self->priv->transferred_bytes = tp_asv_get_uint64 (properties,
      "TransferredBytes", &valid);
  if (!valid)
    {
      DEBUG ("Channel %s doesn't have FileTransfer.TransferredBytes property",
          tp_proxy_get_object_path (self));
    }

  self->priv->initial_offset = tp_asv_get_uint64 (properties, "InitialOffset",
      &valid);
  if (!valid)
    {
      DEBUG ("Channel %s doesn't have FileTransfer.InitialOffset property",
          tp_proxy_get_object_path (self));
    }

out:
  g_simple_async_result_complete (result);
}

/* Private methods */

static void
tp_file_transfer_channel_prepare_core_async (TpProxy *proxy,
    const TpProxyFeature *feature,
    GAsyncReadyCallback callback,
    gpointer user_data)
{
  TpFileTransferChannel *self = (TpFileTransferChannel *) proxy;
  TpChannel *channel = (TpChannel *) proxy;
  GSimpleAsyncResult *result;
  GError *error = NULL;

  tp_cli_channel_type_file_transfer_connect_to_file_transfer_state_changed (
      channel, tp_file_transfer_channel_state_changed_cb,
      NULL, NULL, NULL, &error);
  if (error != NULL)
    {
      WARNING ("Failed to connect to StateChanged on %s: %s",
          tp_proxy_get_object_path (self), error->message);
      g_error_free (error);
    }

  tp_cli_channel_type_file_transfer_connect_to_initial_offset_defined (
      channel, tp_file_transfer_channel_initial_offset_defined_cb,
      NULL, NULL, NULL, &error);
  if (error != NULL)
    {
      WARNING ("Failed to connect to InitialOffsetDefined on %s: %s",
          tp_proxy_get_object_path (self), error->message);
      g_error_free (error);
    }

  tp_cli_channel_type_file_transfer_connect_to_transferred_bytes_changed (
      channel, tp_file_transfer_channel_transferred_bytes_changed_cb,
      NULL, NULL, NULL, &error);
  if (error != NULL)
    {
      WARNING ("Failed to connect to TransferredBytesChanged on %s: %s",
          tp_proxy_get_object_path (self), error->message);
      g_error_free (error);
    }

  result = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
      tp_file_transfer_channel_prepare_core_async);

  tp_cli_dbus_properties_call_get_all (self, -1,
      TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER,
      tp_file_transfer_channel_prepare_core_cb,
      result, g_object_unref,
      NULL);
}

static void
tp_file_transfer_channel_constructed (GObject *obj)
{
  TpFileTransferChannel *self = (TpFileTransferChannel *) obj;
  GHashTable *properties;
  gboolean valid;
  gint64 date;

  G_OBJECT_CLASS (tp_file_transfer_channel_parent_class)->constructed (obj);

  properties = tp_channel_borrow_immutable_properties (TP_CHANNEL (self));

  self->priv->mime_type = tp_asv_get_string (properties,
    TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_CONTENT_TYPE);
  if (self->priv->mime_type == NULL)
    {
      DEBUG ("Channel %s doesn't have FileTransfer.ContentType in its "
          "immutable properties", tp_proxy_get_object_path (self));
    }

  self->priv->filename = tp_asv_get_string (properties,
    TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_FILENAME);
  if (self->priv->filename == NULL)
    {
      DEBUG ("Channel %s doesn't have FileTransfer.Filename in its "
          "immutable properties", tp_proxy_get_object_path (self));
    }

  self->priv->size = tp_asv_get_uint64 (properties,
    TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_SIZE, &valid);
  if (!valid)
    {
      DEBUG ("Channel %s doesn't have FileTransfer.Size in its "
          "immutable properties", tp_proxy_get_object_path (self));
    }

  self->priv->content_hash_type = tp_asv_get_uint32 (properties,
    TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_CONTENT_HASH_TYPE, &valid);
  if (!valid)
    {
      DEBUG ("Channel %s doesn't have FileTransfer.ContentHashType in its "
          "immutable properties", tp_proxy_get_object_path (self));
    }

  self->priv->content_hash = tp_asv_get_string (properties,
    TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_CONTENT_HASH);
  if (self->priv->content_hash == NULL)
    {
      DEBUG ("Channel %s doesn't have FileTransfer.ContentHash in its "
          "immutable properties", tp_proxy_get_object_path (self));
    }

  self->priv->description = tp_asv_get_string (properties,
    TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_DESCRIPTION);
  if (self->priv->description == NULL)
    {
      DEBUG ("Channel %s doesn't have FileTransfer.Description in its "
          "immutable properties", tp_proxy_get_object_path (self));
    }

  date = tp_asv_get_int64 (properties, TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_DATE,
      &valid);

  if (!valid)
    {
      DEBUG ("Channel %s doesn't have FileTransfer.Date in its "
          "immutable properties", tp_proxy_get_object_path (self));
    }
  else
    {
      self->priv->date = g_date_time_new_from_unix_utc (date);
    }

  self->priv->available_socket_types = tp_asv_get_boxed (properties,
     TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_AVAILABLE_SOCKET_TYPES,
     TP_HASH_TYPE_SUPPORTED_SOCKET_MAP);
  if (self->priv->available_socket_types == NULL)
    {
      DEBUG ("Channel %s doesn't have FileTransfer.AvailableSocketTypes in its "
          "immutable properties", tp_proxy_get_object_path (self));
    }
}

static void
tp_file_transfer_channel_get_property (GObject *object,
    guint property_id,
    GValue *value,
    GParamSpec *pspec)
{
  TpFileTransferChannel *self = (TpFileTransferChannel *) object;

  switch (property_id)
    {
      case PROP_MIME_TYPE:
        g_value_set_string (value, self->priv->mime_type);
        break;

      case PROP_DATE:
        g_value_set_boxed (value, self->priv->date);
        break;

      case PROP_DESCRIPTION:
        g_value_set_string (value, self->priv->description);
        break;

      case PROP_FILENAME:
        g_value_set_string (value, self->priv->filename);
        break;

      case PROP_SIZE:
        g_value_set_uint64 (value, self->priv->size);
        break;

      case PROP_TRANSFERRED_BYTES:
        g_value_set_uint64 (value, self->priv->transferred_bytes);
        break;

      default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
        break;
    }
}

enum /* features */
{
  FEAT_CORE,
  N_FEAT
};

static const TpProxyFeature *
tp_file_transfer_channel_list_features (TpProxyClass *cls G_GNUC_UNUSED)
{
  static TpProxyFeature features[N_FEAT + 1] = { { 0 } };

  if (G_LIKELY (features[0].name != 0))
      return features;

  features[FEAT_CORE].name = TP_FILE_TRANSFER_CHANNEL_FEATURE_CORE;
  features[FEAT_CORE].core = TRUE;
  features[FEAT_CORE].prepare_async =
    tp_file_transfer_channel_prepare_core_async;

  /* Assert that the terminator at the end is present */
  g_assert (features[N_FEAT].name == 0);

  return features;
}

static void
tp_file_transfer_channel_dispose (GObject *obj)
{
  TpFileTransferChannel *self = (TpFileTransferChannel *) obj;

  tp_clear_pointer (&self->priv->date, g_date_time_unref);

  G_OBJECT_CLASS (tp_file_transfer_channel_parent_class)->dispose (obj);
}

static void
tp_file_transfer_channel_class_init (TpFileTransferChannelClass *klass)
{
  GParamSpec *param_spec;
  TpProxyClass *proxy_class = (TpProxyClass *) klass;
  GObjectClass *object_class = (GObjectClass *) klass;

  object_class->constructed = tp_file_transfer_channel_constructed;
  object_class->get_property = tp_file_transfer_channel_get_property;
  object_class->dispose = tp_file_transfer_channel_dispose;

  proxy_class->list_features = tp_file_transfer_channel_list_features;

  /* Properties */

  /**
   * TpFileTransferChannel:mime-type:
   *
   * The MIME type of the file to be transferred.
   *
   * Since: 0.15.UNRELEASED
   */
  param_spec = g_param_spec_string ("mime-type",
      "ContentType",
      "The ContentType property of this channel",
      NULL,
      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (object_class, PROP_MIME_TYPE,
      param_spec);

  /**
   * TpFileTransferChannel:date
   *
   * A #GDateTime representing the last modification time of the file to be
   * transferred.
   *
   * Since 0.15.UNRELEASED
   */
  param_spec = g_param_spec_boxed ("date",
      "Date",
      "The Date property of this channel",
      G_TYPE_DATE_TIME,
      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (object_class, PROP_DATE,
      param_spec);

  /**
   * TpFileTransferChannel:description
   *
   * The description of the file transfer, defined by the sender when offering
   * the file.
   *
   * Since 0.15.UNRELEASED
   */
  param_spec = g_param_spec_string ("description",
      "Description",
      "The Description property of this channel",
      NULL,
      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (object_class, PROP_DESCRIPTION,
      param_spec);

  /**
   * TpFileTransferChannel:filename
   *
   * The name of the file on the sender's side. This is therefore given as a
   * suggested filename for the receiver.
   *
   * Since 0.15.UNRELEASED
   */
  param_spec = g_param_spec_string ("filename",
      "Filename",
      "The Filename property of this channel",
      NULL,
      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (object_class, PROP_FILENAME,
      param_spec);

  /**
   * TpFileTransferChannel:size
   *
   * The size of the file to be transferred,
   * or %G_MAXUINT64 if not known.
   *
   * Since 0.15.UNRELEASED
   */
  param_spec = g_param_spec_uint64 ("size",
      "Size",
      "The Size property of this channel",
      0, G_MAXUINT64, 0,
      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (object_class, PROP_SIZE,
      param_spec);

  /**
   * TpFileTransferChannel:transferred-bytes
   *
   * The number of bytes transferred so far in this
   * file transfer.
   *
   * The %TP_FILE_TRANSFER_CHANNEL_FEATURE_CORE feature has to be prepared for
   * this property to be meaningful and kept up to date.
   *
   * Since: 0.15.UNRELEASED
   */
  param_spec = g_param_spec_uint64 ("transferred-bytes",
      "TransferredBytes",
      "The TransferredBytes property of this channel",
      0, G_MAXUINT64, 0,
      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
  g_object_class_install_property (object_class, PROP_TRANSFERRED_BYTES,
      param_spec);

  g_type_class_add_private (object_class, sizeof
      (TpFileTransferChannelPrivate));
}

static void
tp_file_transfer_channel_init (TpFileTransferChannel *self)
{
  self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self),
      TP_TYPE_FILE_TRANSFER_CHANNEL, TpFileTransferChannelPrivate);
}

/**
 * TP_FILE_TRANSFER_CHANNEL_FEATURE_CORE:
 *
 * Expands to a call to a function that returns a quark for the "core"
 * feature on a #TpFileTransferChannel.
 *
 * When this feature is prepared, the #TpFileTransferChannel:transferred-bytes
 * property has been retrieved and will be updated.
 *
 * One can ask for a feature to be prepared using the tp_proxy_prepare_async()
 * function, and waiting for it to trigger the callback.
 *
 * Since: 0.15.UNRELEASED
 */

GQuark
tp_file_transfer_channel_get_feature_quark_core (void)
{
  return g_quark_from_static_string ("tp-file-transfer-channel-feature-core");
}


/* Public methods */

/**
 * tp_file_transfer_channel_new:
 * @conn: a #TpConnection; may not be %NULL
 * @object_path: the object path of the channel; may not be %NULL
 * @immutable_properties: (transfer none) (element-type utf8 GObject.Value):
 *  the immutable properties of the channel,
 *  as signalled by the NewChannel D-Bus signal or returned by the
 *  CreateChannel and EnsureChannel D-Bus methods: a mapping from
 *  strings (D-Bus interface name + "." + property name) to #GValue instances
 * @error: used to indicate the error if %NULL is returned
 *
 * Convenient function to create a new #TpFileTransferChannel
 *
 * Returns: (transfer full): a newly created #TpFileTransferChannel
 *
 * Since: 0.15.UNRELEASED
 */
TpFileTransferChannel *
tp_file_transfer_channel_new (TpConnection *conn,
    const gchar *object_path,
    const GHashTable *immutable_properties,
    GError **error)
{
  return _tp_file_transfer_channel_new_with_factory (NULL, conn, object_path,
      immutable_properties, error);
}

TpFileTransferChannel *
_tp_file_transfer_channel_new_with_factory (
    TpSimpleClientFactory *factory,
    TpConnection *conn,
    const gchar *object_path,
    const GHashTable *immutable_properties,
    GError **error)
{
  TpProxy *conn_proxy = (TpProxy *) conn;

  g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
  g_return_val_if_fail (object_path != NULL, NULL);
  g_return_val_if_fail (immutable_properties != NULL, NULL);

  if (!tp_dbus_check_valid_object_path (object_path, error))
      return NULL;

  return g_object_new (TP_TYPE_FILE_TRANSFER_CHANNEL,
      "connection", conn,
      "dbus-daemon", conn_proxy->dbus_daemon,
      "bus-name", conn_proxy->bus_name,
      "object-path", object_path,
      "handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
      "channel-properties", immutable_properties,
      "factory", factory,
      NULL);
}

/* Property accessors */

/**
 * tp_file_transfer_channel_get_mime_type
 * @self: a #TpFileTransferChannel
 *
 * Return the #TpFileTransferChannel:mime-type property
 *
 * Returns: (transfer none): the value of the
 * #TpFileTransferChannel:mime-type property
 *
 * Since: 0.15.UNRELEASED
 */
const char *
tp_file_transfer_channel_get_mime_type (TpFileTransferChannel *self)
{
  g_return_val_if_fail (TP_IS_FILE_TRANSFER_CHANNEL (self), NULL);

  return self->priv->mime_type;
}

/**
 * tp_file_transfer_channel_get_date
 * @self: a #TpFileTransferChannel
 *
 * Return the #TpFileTransferChannel:date property
 *
 * Returns: (transfer none): the value of the #TpFileTransferChannel:date
 * property
 *
 * Since: 0.15.UNRELEASED
 */
GDateTime *
tp_file_transfer_channel_get_date (TpFileTransferChannel *self)
{
  g_return_val_if_fail (TP_IS_FILE_TRANSFER_CHANNEL (self), NULL);

  return self->priv->date;
}

/**
 * tp_file_transfer_channel_get_description
 * @self: a #TpFileTransferChannel
 *
 * Return the #TpFileTransferChannel:description property
 *
 * Returns: (transfer none): the value of the #TpFileTransferChannel:description
 * property
 *
 * Since: 0.15.UNRELEASED
 */
const gchar *
tp_file_transfer_channel_get_description (TpFileTransferChannel *self)
{
  g_return_val_if_fail (TP_IS_FILE_TRANSFER_CHANNEL (self), NULL);

  return self->priv->description;
}

/**
 * tp_file_transfer_channel_get_filename
 * @self: a #TpFileTransferChannel
 *
 * Return the #TpFileTransferChannel:filename property
 *
 * Returns: (transfer none): the value of the #TpFileTransferChannel:filename
 * property
 *
 * Since: 0.15.UNRELEASED
 */
const gchar *
tp_file_transfer_channel_get_filename (TpFileTransferChannel *self)
{
  g_return_val_if_fail (TP_IS_FILE_TRANSFER_CHANNEL (self), NULL);

  return self->priv->filename;
}

/**
 * tp_file_transfer_channel_get_size
 * @self: a #TpFileTransferChannel
 *
 * Return the #TpFileTransferChannel:size property
 *
 * Returns: the value of the #TpFileTransferChannel:size property
 *
 * Since: 0.15.UNRELEASED
 */
guint64
tp_file_transfer_channel_get_size (TpFileTransferChannel *self)
{
  g_return_val_if_fail (TP_IS_FILE_TRANSFER_CHANNEL (self), 0);

  return self->priv->size;
}

/**
 * tp_file_transfer_channel_get_transferred_bytes
 * @self: a #TpFileTransferChannel
 *
 * Return the #TpFileTransferChannel:transferred-bytes property
 *
 * Returns: the value of the #TpFileTransferChannel:transferred-bytes property
 *
 * Since: 0.15.UNRELEASED
 */
guint64
tp_file_transfer_channel_get_transferred_bytes (TpFileTransferChannel *self)
{
  g_return_val_if_fail (TP_IS_FILE_TRANSFER_CHANNEL (self), 0);

  return self->priv->transferred_bytes;
}