| |
1 /* |
| |
2 * Purple - Internet Messaging Library |
| |
3 * Copyright (C) Pidgin Developers <devel@pidgin.im> |
| |
4 * |
| |
5 * Purple is the legal property of its developers, whose names are too numerous |
| |
6 * to list here. Please refer to the COPYRIGHT file distributed with this |
| |
7 * source distribution. |
| |
8 * |
| |
9 * This program is free software; you can redistribute it and/or modify |
| |
10 * it under the terms of the GNU General Public License as published by |
| |
11 * the Free Software Foundation; either version 2 of the License, or |
| |
12 * (at your option) any later version. |
| |
13 * |
| |
14 * This program is distributed in the hope that it will be useful, |
| |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| |
17 * GNU General Public License for more details. |
| |
18 * |
| |
19 * You should have received a copy of the GNU General Public License |
| |
20 * along with this program; if not, see <https://www.gnu.org/licenses/>. |
| |
21 */ |
| |
22 |
| |
23 #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION) |
| |
24 # error "only <purple.h> may be included directly" |
| |
25 #endif |
| |
26 |
| |
27 #ifndef PURPLE_PROTOCOL_FILE_TRANSFER_H |
| |
28 #define PURPLE_PROTOCOL_FILE_TRANSFER_H |
| |
29 |
| |
30 #include <glib.h> |
| |
31 #include <glib-object.h> |
| |
32 |
| |
33 #include "purplefiletransfer.h" |
| |
34 #include "purpleprotocol.h" |
| |
35 |
| |
36 #define PURPLE_TYPE_PROTOCOL_FILE_TRANSFER (purple_protocol_file_transfer_get_type()) |
| |
37 G_DECLARE_INTERFACE(PurpleProtocolFileTransfer, |
| |
38 purple_protocol_file_transfer, PURPLE, |
| |
39 PROTOCOL_FILE_TRANSFER, PurpleProtocol) |
| |
40 |
| |
41 /** |
| |
42 * PurpleProtocolFileTransfer: |
| |
43 * |
| |
44 * #PurpleProtocolFileTransfer provides methods for sending and receiving |
| |
45 * files. |
| |
46 * |
| |
47 * Since: 3.0.0 |
| |
48 */ |
| |
49 |
| |
50 /** |
| |
51 * PurpleProtocolFileTransferInterface: |
| |
52 * |
| |
53 * This interface defines the behavior for sending and receiving files. |
| |
54 * |
| |
55 * Since: 3.0.0 |
| |
56 */ |
| |
57 struct _PurpleProtocolFileTransferInterface { |
| |
58 /*< private >*/ |
| |
59 GTypeInterface parent; |
| |
60 |
| |
61 /*< public >*/ |
| |
62 void (*send_async)(PurpleProtocolFileTransfer *protocol, PurpleFileTransfer *transfer, GAsyncReadyCallback callback, gpointer data); |
| |
63 gboolean (*send_finish)(PurpleProtocolFileTransfer *protocol, GAsyncResult *result, GError **error); |
| |
64 |
| |
65 void (*receive_async)(PurpleProtocolFileTransfer *protocol, PurpleFileTransfer *transfer, GAsyncReadyCallback callback, gpointer data); |
| |
66 gboolean (*receive_finish)(PurpleProtocolFileTransfer *protocol, GAsyncResult *result, GError **error); |
| |
67 |
| |
68 /*< private >*/ |
| |
69 gpointer reserved[4]; |
| |
70 }; |
| |
71 |
| |
72 G_BEGIN_DECLS |
| |
73 |
| |
74 /** |
| |
75 * purple_protocol_file_transfer_send_async: |
| |
76 * @protocol: The instance. |
| |
77 * @transfer: The file transfer to send. |
| |
78 * @callback: (scope async): a #GAsyncReadyCallback to call when the request is |
| |
79 * satisfied. |
| |
80 * @data: User data to pass to @callback. |
| |
81 * |
| |
82 * Starts the process of sending @transfer. |
| |
83 * |
| |
84 * > Note: This function does not take a cancellable as the protocol should be |
| |
85 * using [property@FileTransfer:cancellable] from @transfer. |
| |
86 * |
| |
87 * Since: 3.0.0 |
| |
88 */ |
| |
89 void purple_protocol_file_transfer_send_async(PurpleProtocolFileTransfer *protocol, PurpleFileTransfer *transfer, GAsyncReadyCallback callback, gpointer data); |
| |
90 |
| |
91 /** |
| |
92 * purple_protocol_file_transfer_send_finish: |
| |
93 * @protocol: The instance. |
| |
94 * @result: The [iface@Gio.AsyncResult] from the previous |
| |
95 * [method@ProtocolFileTransfer.send_async] call. |
| |
96 * @error: Return address for a #GError, or %NULL. |
| |
97 * |
| |
98 * Finishes a previous call to [method@ProtocolFileTransfer.send_async] and |
| |
99 * gets the result. |
| |
100 * |
| |
101 * Returns: %TRUE if the transfer was started successfully, otherwise %FALSE |
| |
102 * with @error possibly set. |
| |
103 * |
| |
104 * Since: 3.0.0 |
| |
105 */ |
| |
106 gboolean purple_protocol_file_transfer_send_finish(PurpleProtocolFileTransfer *protocol, GAsyncResult *result, GError **error); |
| |
107 |
| |
108 /** |
| |
109 * purple_protocol_file_transfer_receive_async: |
| |
110 * @protocol: The instance. |
| |
111 * @transfer: The file transfer to send. |
| |
112 * @callback: (scope async): a #GAsyncReadyCallback to call when the request is |
| |
113 * satisfied. |
| |
114 * @data: User data to pass to @callback. |
| |
115 * |
| |
116 * Starts the process of receiving @transfer. |
| |
117 * |
| |
118 * > Note: This function does not take a cancellable as the protocol should be |
| |
119 * using [property@FileTransfer:cancellable] from @transfer. |
| |
120 * |
| |
121 * Since: 3.0.0 |
| |
122 */ |
| |
123 void purple_protocol_file_transfer_receive_async(PurpleProtocolFileTransfer *protocol, PurpleFileTransfer *transfer, GAsyncReadyCallback callback, gpointer data); |
| |
124 |
| |
125 /** |
| |
126 * purple_protocol_file_transfer_receive_finish: |
| |
127 * @protocol: The instance. |
| |
128 * @result: The [iface@Gio.AsyncResult] from the previous |
| |
129 * [method@ProtocolFileTransfer.receive_async] call. |
| |
130 * @error: Return address for a #GError, or %NULL. |
| |
131 * |
| |
132 * Finishes a previous call to [method@ProtocolFileTransfer.receive_async] and |
| |
133 * gets the result. |
| |
134 * |
| |
135 * Returns: %TRUE if the transfer was started successfully, otherwise %FALSE |
| |
136 * with @error possibly set. |
| |
137 * |
| |
138 * Since: 3.0.0 |
| |
139 */ |
| |
140 gboolean purple_protocol_file_transfer_receive_finish(PurpleProtocolFileTransfer *protocol, GAsyncResult *result, GError **error); |
| |
141 |
| |
142 G_END_DECLS |
| |
143 |
| |
144 #endif /* PURPLE_PROTOCOL_FILE_TRANSFER_H */ |