summaryrefslogtreecommitdiff
path: root/telepathy-glib/file-transfer-channel.h
blob: 60b81c7b676129b56f7b806cd9c6561a93c3f0b7 (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
/*
 * file-transfer-channel.h - high level API for File Transfer channels
 *
 * 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
 */

#if defined (TP_DISABLE_SINGLE_INCLUDE) && !defined (_TP_IN_META_HEADER) && !defined (_TP_COMPILATION)
#error "Only <telepathy-glib/telepathy-glib.h> and <telepathy-glib/telepathy-glib-dbus.h> can be included directly."
#endif

#ifndef __TP_FILE_TRANSFER_CHANNEL_H__
#define __TP_FILE_TRANSFER_CHANNEL_H__

#include <telepathy-glib/channel.h>
#include <telepathy-glib/defs.h>

G_BEGIN_DECLS


#define TP_TYPE_FILE_TRANSFER_CHANNEL (tp_file_transfer_channel_get_type ())
#define TP_FILE_TRANSFER_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TP_TYPE_FILE_TRANSFER_CHANNEL, TpFileTransferChannel))
#define TP_FILE_TRANSFER_CHANNEL_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), TP_TYPE_FILE_TRANSFER_CHANNEL, TpFileTransferChannelClass))
#define TP_IS_FILE_TRANSFER_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TP_TYPE_FILE_TRANSFER_CHANNEL))
#define TP_IS_FILE_TRANSFER_CHANNEL_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), TP_TYPE_FILE_TRANSFER_CHANNEL))
#define TP_FILE_TRANSFER_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_FILE_TRANSFER_CHANNEL, TpFileTransferChannelClass))

typedef struct _TpFileTransferChannel TpFileTransferChannel;
typedef struct _TpFileTransferChannelClass TpFileTransferChannelClass;
typedef struct _TpFileTransferChannelPrivate TpFileTransferChannelPrivate;

struct _TpFileTransferChannel
{
  /*<private>*/
  TpChannel parent;
  TpFileTransferChannelPrivate *priv;
};

struct _TpFileTransferChannelClass
{
  /*<private>*/
  TpChannelClass parent_class;
  GCallback _padding[8];
};

#define TP_FILE_TRANSFER_CHANNEL_FEATURE_CORE \
  tp_file_transfer_channel_get_feature_quark_core ()
_TP_AVAILABLE_IN_0_16
GQuark tp_file_transfer_channel_get_feature_quark_core (void) G_GNUC_CONST;

_TP_AVAILABLE_IN_0_16
GType tp_file_transfer_channel_get_type (void);

/* Methods */

_TP_AVAILABLE_IN_0_16
_TP_DEPRECATED_IN_0_20_FOR(tp_simple_client_factory_ensure_channel)
TpFileTransferChannel * tp_file_transfer_channel_new (TpConnection *conn,
    const gchar *object_path,
    const GHashTable *immutable_properties,
    GError **error);

_TP_AVAILABLE_IN_0_18
void tp_file_transfer_channel_accept_file_async (TpFileTransferChannel *self,
    GFile *file,
    guint64 offset,
    GAsyncReadyCallback callback,
    gpointer user_data);

_TP_AVAILABLE_IN_0_18
gboolean tp_file_transfer_channel_accept_file_finish (
    TpFileTransferChannel *self,
    GAsyncResult *result,
    GError **error);

_TP_AVAILABLE_IN_0_18
void tp_file_transfer_channel_provide_file_async (TpFileTransferChannel *self,
    GFile *file,
    GAsyncReadyCallback callback,
    gpointer user_data);

_TP_AVAILABLE_IN_0_18
gboolean tp_file_transfer_channel_provide_file_finish (
    TpFileTransferChannel *self,
    GAsyncResult *result,
    GError **error);

/* Property accessors */

_TP_AVAILABLE_IN_0_16
const char * tp_file_transfer_channel_get_mime_type (
    TpFileTransferChannel *self);

_TP_AVAILABLE_IN_0_16
GDateTime * tp_file_transfer_channel_get_date (TpFileTransferChannel *self);

_TP_AVAILABLE_IN_0_18
TpFileTransferState tp_file_transfer_channel_get_state (
    TpFileTransferChannel *self,
    TpFileTransferStateChangeReason *reason);

_TP_AVAILABLE_IN_0_16
const gchar * tp_file_transfer_channel_get_description (
    TpFileTransferChannel *self);

_TP_AVAILABLE_IN_0_16
const gchar * tp_file_transfer_channel_get_filename (
    TpFileTransferChannel *self);

_TP_AVAILABLE_IN_0_16
guint64 tp_file_transfer_channel_get_size (TpFileTransferChannel *self);

_TP_AVAILABLE_IN_0_16
guint64 tp_file_transfer_channel_get_transferred_bytes (
    TpFileTransferChannel *self);

/* Metadata */

_TP_AVAILABLE_IN_0_18
const gchar * tp_file_transfer_channel_get_service_name (
    TpFileTransferChannel *self);

_TP_AVAILABLE_IN_0_18
const GHashTable * tp_file_transfer_channel_get_metadata (
    TpFileTransferChannel *self);

G_END_DECLS

#endif