Mercurial > pidgin
annotate src/ft.h @ 8290:84ec38c3efcc
[gaim-migrate @ 9014]
Moved the Get User Info and Insert Link dialogs to the request API.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 19 Feb 2004 08:06:23 +0000 |
parents | f50c059b6384 |
children | e4087b5c0627 |
rev | line source |
---|---|
4514 | 1 /** |
7820 | 2 * @file ft.h File Transfer API |
5034
4691c5936c01
[gaim-migrate @ 5377]
Christian Hammond <chipx86@chipx86.com>
parents:
4675
diff
changeset
|
3 * @ingroup core |
4514 | 4 * |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8211
diff
changeset
|
10 * |
4514 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 #ifndef _GAIM_FT_H_ | |
26 #define _GAIM_FT_H_ | |
27 | |
28 /**************************************************************************/ | |
29 /** Data Structures */ | |
30 /**************************************************************************/ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
31 typedef struct _GaimXfer GaimXfer; |
4514 | 32 |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
33 #include "account.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
34 |
4514 | 35 /** |
36 * Types of file transfers. | |
37 */ | |
38 typedef enum | |
39 { | |
40 GAIM_XFER_UNKNOWN = 0, /**< Unknown file transfer type. */ | |
41 GAIM_XFER_SEND, /**< File sending. */ | |
42 GAIM_XFER_RECEIVE /**< File receiving. */ | |
43 | |
44 } GaimXferType; | |
45 | |
7805 | 46 /** |
47 * The different states of the xfer. | |
48 */ | |
7738 | 49 typedef enum |
50 { | |
7805 | 51 GAIM_XFER_STATUS_UNKNOWN = 0, /**< Unknown, the xfer may be null. */ |
52 GAIM_XFER_STATUS_NOT_STARTED, /**< It hasn't started yet. */ | |
53 GAIM_XFER_STATUS_STARTED, /**< gaim_xfer_start has been called. */ | |
54 GAIM_XFER_STATUS_DONE, /**< The xfer completed successfully. */ | |
55 GAIM_XFER_STATUS_CANCEL_LOCAL, /**< The xfer was canceled by us. */ | |
7887 | 56 GAIM_XFER_STATUS_CANCEL_REMOTE /**< The xfer was canceled by the other end, or we couldn't connect. */ |
7805 | 57 } GaimXferStatusType; |
7738 | 58 |
4514 | 59 /** |
60 * File transfer UI operations. | |
61 * | |
62 * Any UI representing a file transfer must assign a filled-out | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
63 * GaimXferUiOps structure to the gaim_xfer. |
4514 | 64 */ |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
65 typedef struct |
4514 | 66 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
67 void (*new_xfer)(GaimXfer *xfer); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
68 void (*destroy)(GaimXfer *xfer); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
69 void (*request_file)(GaimXfer *xfer); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
70 void (*ask_cancel)(GaimXfer *xfer); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
71 void (*add_xfer)(GaimXfer *xfer); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
72 void (*update_progress)(GaimXfer *xfer, double percent); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
73 void (*cancel_local)(GaimXfer *xfer); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
74 void (*cancel_remote)(GaimXfer *xfer); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
75 |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
76 } GaimXferUiOps; |
4514 | 77 |
78 /** | |
79 * A core representation of a file transfer. | |
80 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
81 struct _GaimXfer |
4514 | 82 { |
7887 | 83 guint ref; /**< The reference count. */ |
4514 | 84 GaimXferType type; /**< The type of transfer. */ |
85 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
86 GaimAccount *account; /**< The account. */ |
4514 | 87 |
88 char *who; /**< The person on the other end of the | |
89 transfer. */ | |
90 | |
4605 | 91 char *filename; /**< The name sent over the network. */ |
92 char *local_filename; /**< The name on the local hard drive. */ | |
4514 | 93 size_t size; /**< The size of the file. */ |
94 | |
95 FILE *dest_fp; /**< The destination file pointer. */ | |
96 | |
97 char *remote_ip; /**< The remote IP address. */ | |
98 int local_port; /**< The local port. */ | |
99 int remote_port; /**< The remote port. */ | |
100 | |
101 int fd; /**< The socket file descriptor. */ | |
102 int watcher; /**< Watcher. */ | |
103 | |
104 size_t bytes_sent; /**< The number of bytes sent. */ | |
105 size_t bytes_remaining; /**< The number of bytes remaining. */ | |
106 | |
7805 | 107 GaimXferStatusType status; /**< File Transfer's status. */ |
4538 | 108 |
4514 | 109 /* I/O operations. */ |
110 struct | |
111 { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
112 void (*init)(GaimXfer *xfer); |
7805 | 113 void (*request_denied)(GaimXfer *xfer); |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
114 void (*start)(GaimXfer *xfer); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
115 void (*end)(GaimXfer *xfer); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
116 void (*cancel_send)(GaimXfer *xfer); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
117 void (*cancel_recv)(GaimXfer *xfer); |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8211
diff
changeset
|
118 ssize_t (*read)(char **buffer, GaimXfer *xfer); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8211
diff
changeset
|
119 ssize_t (*write)(const char *buffer, size_t size, GaimXfer *xfer); |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
120 void (*ack)(GaimXfer *xfer, const char *buffer, size_t size); |
4514 | 121 |
122 } ops; | |
123 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
124 GaimXferUiOps *ui_ops; /**< UI-specific operations. */ |
4514 | 125 void *ui_data; /**< UI-specific data. */ |
126 | |
127 void *data; /**< prpl-specific data. */ | |
128 }; | |
129 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
130 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
131 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
132 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
133 |
4514 | 134 /**************************************************************************/ |
135 /** @name File Transfer API */ | |
136 /**************************************************************************/ | |
137 /*@{*/ | |
138 | |
139 /** | |
140 * Creates a new file transfer handle. | |
7805 | 141 * This is called by prpls. |
142 * The handle starts with a ref count of 1, and this reference | |
143 * is owned by the core. The prpl normally does not need to | |
144 * gaim_xfer_ref or unref. | |
4514 | 145 * |
146 * @param account The account sending or receiving the file. | |
147 * @param type The type of file transfer. | |
148 * @param who The name of the remote user. | |
149 * | |
150 * @return A file transfer handle. | |
151 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
152 GaimXfer *gaim_xfer_new(GaimAccount *account, |
4514 | 153 GaimXferType type, const char *who); |
154 | |
155 /** | |
7805 | 156 * Increases the reference count on a GaimXfer. |
157 * Please call gaim_xfer_unref later. | |
4514 | 158 * |
7805 | 159 * @param xfer A file transfer handle. |
4514 | 160 */ |
7805 | 161 void gaim_xfer_ref(GaimXfer *xfer); |
162 | |
163 /** | |
164 * Decreases the reference count on a GaimXfer. | |
165 * If the reference reaches 0, gaim_xfer_destroy (an internal function) | |
166 * will destroy the xfer. It calls the ui destroy cb first. | |
167 * Since the core keeps a ref on the xfer, only an erronous call to | |
168 * this function will destroy the xfer while still in use. | |
169 * | |
170 * @param xfer A file transfer handle. | |
171 */ | |
172 void gaim_xfer_unref(GaimXfer *xfer); | |
4514 | 173 |
174 /** | |
175 * Requests confirmation for a file transfer from the user. | |
176 * | |
177 * @param xfer The file transfer to request confirmation on. | |
178 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
179 void gaim_xfer_request(GaimXfer *xfer); |
4514 | 180 |
181 /** | |
182 * Called if the user accepts the file transfer request. | |
183 * | |
184 * @param xfer The file transfer. | |
185 * @param filename The filename. | |
186 */ | |
7805 | 187 void gaim_xfer_request_accepted(GaimXfer *xfer, const char *filename); |
4514 | 188 |
189 /** | |
190 * Called if the user rejects the file transfer request. | |
191 * | |
192 * @param xfer The file transfer. | |
193 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
194 void gaim_xfer_request_denied(GaimXfer *xfer); |
4514 | 195 |
196 /** | |
197 * Returns the type of file transfer. | |
198 * | |
199 * @param xfer The file transfer. | |
200 * | |
201 * @return The type of the file transfer. | |
202 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
203 GaimXferType gaim_xfer_get_type(const GaimXfer *xfer); |
4514 | 204 |
205 /** | |
206 * Returns the account the file transfer is using. | |
207 * | |
208 * @param xfer The file transfer. | |
209 * | |
210 * @return The account. | |
211 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
212 GaimAccount *gaim_xfer_get_account(const GaimXfer *xfer); |
4514 | 213 |
214 /** | |
7805 | 215 * Returns the status of the xfer. |
216 * | |
217 * @param xfer The file transfer. | |
218 * | |
219 * @return The status. | |
220 */ | |
221 GaimXferStatusType gaim_xfer_get_status(const GaimXfer *xfer); | |
222 | |
223 /** | |
7738 | 224 * Returns true if the file transfer was canceled. |
225 * | |
226 * @param xfer The file transfer. | |
227 * | |
228 * @return Whether or not the transfer was canceled. | |
229 */ | |
7805 | 230 gboolean gaim_xfer_is_canceled(const GaimXfer *xfer); |
7738 | 231 |
232 /** | |
4539
05476ef20d58
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
233 * Returns the completed state for a file transfer. |
05476ef20d58
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
234 * |
05476ef20d58
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
235 * @param xfer The file transfer. |
05476ef20d58
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
236 * |
05476ef20d58
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
237 * @return The completed state. |
05476ef20d58
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
238 */ |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
239 gboolean gaim_xfer_is_completed(const GaimXfer *xfer); |
4539
05476ef20d58
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
240 |
05476ef20d58
[gaim-migrate @ 4818]
Christian Hammond <chipx86@chipx86.com>
parents:
4538
diff
changeset
|
241 /** |
4514 | 242 * Returns the name of the file being sent or received. |
243 * | |
244 * @param xfer The file transfer. | |
245 * | |
246 * @return The filename. | |
247 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
248 const char *gaim_xfer_get_filename(const GaimXfer *xfer); |
4514 | 249 |
250 /** | |
251 * Returns the file's destination filename, | |
252 * | |
253 * @param xfer The file transfer. | |
254 * | |
255 * @return The destination filename. | |
256 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
257 const char *gaim_xfer_get_local_filename(const GaimXfer *xfer); |
4514 | 258 |
259 /** | |
260 * Returns the number of bytes sent so far. | |
261 * | |
262 * @param xfer The file transfer. | |
263 * | |
264 * @return The number of bytes sent. | |
265 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
266 size_t gaim_xfer_get_bytes_sent(const GaimXfer *xfer); |
4514 | 267 |
268 /** | |
269 * Returns the number of bytes received so far. | |
270 * | |
271 * @param xfer The file transfer. | |
272 * | |
273 * @return The number of bytes received. | |
274 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
275 size_t gaim_xfer_get_bytes_remaining(const GaimXfer *xfer); |
4514 | 276 |
277 /** | |
278 * Returns the size of the file being sent or received. | |
279 * | |
280 * @param xfer The file transfer. | |
7805 | 281 * |
4514 | 282 * @return The total size of the file. |
283 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
284 size_t gaim_xfer_get_size(const GaimXfer *xfer); |
4514 | 285 |
286 /** | |
287 * Returns the current percentage of progress of the transfer. | |
288 * | |
289 * This is a number between 0 (0%) and 1 (100%). | |
290 * | |
291 * @param xfer The file transfer. | |
292 * | |
293 * @return The percentage complete. | |
294 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
295 double gaim_xfer_get_progress(const GaimXfer *xfer); |
4514 | 296 |
297 /** | |
298 * Returns the local port number in the file transfer. | |
299 * | |
300 * @param xfer The file transfer. | |
301 * | |
302 * @return The port number on this end. | |
303 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
304 unsigned int gaim_xfer_get_local_port(const GaimXfer *xfer); |
4514 | 305 |
306 /** | |
307 * Returns the remote IP address in the file transfer. | |
308 * | |
309 * @param xfer The file transfer. | |
310 * | |
311 * @return The IP address on the other end. | |
312 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
313 const char *gaim_xfer_get_remote_ip(const GaimXfer *xfer); |
4514 | 314 |
315 /** | |
316 * Returns the remote port number in the file transfer. | |
317 * | |
318 * @param xfer The file transfer. | |
319 * | |
320 * @return The port number on the other end. | |
321 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
322 unsigned int gaim_xfer_get_remote_port(const GaimXfer *xfer); |
4514 | 323 |
324 /** | |
4538 | 325 * Sets the completed state for the file transfer. |
326 * | |
327 * @param xfer The file transfer. | |
328 * @param completed The completed state. | |
329 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
330 void gaim_xfer_set_completed(GaimXfer *xfer, gboolean completed); |
4538 | 331 |
332 /** | |
4514 | 333 * Sets the filename for the file transfer. |
334 * | |
335 * @param xfer The file transfer. | |
336 * @param filename The filename. | |
337 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
338 void gaim_xfer_set_filename(GaimXfer *xfer, const char *filename); |
4514 | 339 |
340 /** | |
4605 | 341 * Sets the local filename for the file transfer. |
4514 | 342 * |
343 * @param xfer The file transfer. | |
344 * @param filename The filename | |
345 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
346 void gaim_xfer_set_local_filename(GaimXfer *xfer, const char *filename); |
4514 | 347 |
348 /** | |
349 * Sets the size of the file in a file transfer. | |
350 * | |
351 * @param xfer The file transfer. | |
352 * @param size The size of the file. | |
353 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
354 void gaim_xfer_set_size(GaimXfer *xfer, size_t size); |
4514 | 355 |
356 /** | |
357 * Returns the UI operations structure for a file transfer. | |
358 * | |
359 * @param xfer The file transfer. | |
360 * | |
361 * @return The UI operations structure. | |
362 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
363 GaimXferUiOps *gaim_xfer_get_ui_ops(const GaimXfer *xfer); |
4514 | 364 |
365 /** | |
366 * Sets the read function for the file transfer. | |
367 * | |
368 * @param xfer The file transfer. | |
369 * @param fnc The read function. | |
370 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
371 void gaim_xfer_set_read_fnc(GaimXfer *xfer, |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8211
diff
changeset
|
372 ssize_t (*fnc)(char **, GaimXfer *)); |
4514 | 373 |
374 /** | |
375 * Sets the write function for the file transfer. | |
376 * | |
377 * @param xfer The file transfer. | |
378 * @param fnc The write function. | |
379 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
380 void gaim_xfer_set_write_fnc(GaimXfer *xfer, |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8211
diff
changeset
|
381 ssize_t (*fnc)(const char *, size_t, GaimXfer *)); |
4514 | 382 |
383 /** | |
384 * Sets the acknowledge function for the file transfer. | |
385 * | |
386 * @param xfer The file transfer. | |
387 * @param fnc The acknowledge function. | |
388 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
389 void gaim_xfer_set_ack_fnc(GaimXfer *xfer, |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
390 void (*fnc)(GaimXfer *, const char *, size_t)); |
4514 | 391 |
392 /** | |
7805 | 393 * Sets the function to be called if the request is denied. |
394 * | |
395 * @param xfer The file transfer. | |
396 * @param fnc The request denied prpl callback. | |
397 */ | |
398 void gaim_xfer_set_request_denied_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); | |
399 | |
400 /** | |
4514 | 401 * Sets the transfer initialization function for the file transfer. |
402 * | |
403 * This function is required, and must call gaim_xfer_start() with | |
404 * the necessary parameters. This will be called if the file transfer | |
405 * is accepted by the user. | |
406 * | |
407 * @param xfer The file transfer. | |
408 * @param fnc The transfer initialization function. | |
409 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
410 void gaim_xfer_set_init_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); |
4514 | 411 |
412 /** | |
413 * Sets the start transfer function for the file transfer. | |
414 * | |
415 * @param xfer The file transfer. | |
416 * @param fnc The start transfer function. | |
417 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
418 void gaim_xfer_set_start_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); |
4514 | 419 |
420 /** | |
421 * Sets the end transfer function for the file transfer. | |
422 * | |
423 * @param xfer The file transfer. | |
424 * @param fnc The end transfer function. | |
425 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
426 void gaim_xfer_set_end_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); |
4514 | 427 |
428 /** | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
429 * Sets the cancel send function for the file transfer. |
4514 | 430 * |
431 * @param xfer The file transfer. | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
432 * @param fnc The cancel send function. |
4514 | 433 */ |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
434 void gaim_xfer_set_cancel_send_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
435 |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
436 /** |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
437 * Sets the cancel receive function for the file transfer. |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
438 * |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
439 * @param xfer The file transfer. |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
440 * @param fnc The cancel receive function. |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
441 */ |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
442 void gaim_xfer_set_cancel_recv_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); |
4514 | 443 |
444 /** | |
445 * Reads in data from a file transfer stream. | |
446 * | |
447 * @param xfer The file transfer. | |
448 * @param buffer The buffer that will be created to contain the data. | |
449 * | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8211
diff
changeset
|
450 * @return The number of bytes read, or -1. |
4514 | 451 */ |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8211
diff
changeset
|
452 ssize_t gaim_xfer_read(GaimXfer *xfer, char **buffer); |
4514 | 453 |
454 /** | |
455 * Writes data to a file transfer stream. | |
456 * | |
457 * @param xfer The file transfer. | |
458 * @param buffer The buffer to read the data from. | |
459 * @param size The number of bytes to write. | |
460 * | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8211
diff
changeset
|
461 * @return The number of bytes written, or -1. |
4514 | 462 */ |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8211
diff
changeset
|
463 ssize_t gaim_xfer_write(GaimXfer *xfer, const char *buffer, size_t size); |
4514 | 464 |
465 /** | |
466 * Starts a file transfer. | |
467 * | |
468 * Either @a fd must be specified <i>or</i> @a ip and @a port on a | |
469 * file receive transfer. On send, @a fd must be specified, and | |
470 * @a ip and @a port are ignored. | |
471 * | |
472 * @param xfer The file transfer. | |
473 * @param fd The file descriptor for the socket. | |
474 * @param ip The IP address to connect to. | |
475 * @param port The port to connect to. | |
476 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
477 void gaim_xfer_start(GaimXfer *xfer, int fd, const char *ip, |
4514 | 478 unsigned int port); |
479 | |
480 /** | |
481 * Ends a file transfer. | |
482 * | |
483 * @param xfer The file transfer. | |
484 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
485 void gaim_xfer_end(GaimXfer *xfer); |
4514 | 486 |
487 /** | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
488 * Cancels a file transfer on the local end. |
4514 | 489 * |
490 * @param xfer The file transfer. | |
491 */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
492 void gaim_xfer_cancel_local(GaimXfer *xfer); |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
493 |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
494 /** |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
495 * Cancels a file transfer from the remote end. |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
496 * |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
497 * @param xfer The file transfer. |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4605
diff
changeset
|
498 */ |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
499 void gaim_xfer_cancel_remote(GaimXfer *xfer); |
4514 | 500 |
501 /** | |
502 * Displays a file transfer-related error message. | |
503 * | |
5499
c8afb821df3e
[gaim-migrate @ 5895]
Christian Hammond <chipx86@chipx86.com>
parents:
5495
diff
changeset
|
504 * This is a wrapper around gaim_notify_error(), which automatically |
4514 | 505 * specifies a title ("File transfer to <i>user</i> aborted" or |
506 * "File Transfer from <i>user</i> aborted"). | |
507 * | |
508 * @param type The type of file transfer. | |
509 * @param who The user on the other end of the transfer. | |
510 * @param msg The message to display. | |
511 */ | |
512 void gaim_xfer_error(GaimXferType type, const char *who, const char *msg); | |
513 | |
6263
3565ee7a5dd3
[gaim-migrate @ 6760]
Christian Hammond <chipx86@chipx86.com>
parents:
6241
diff
changeset
|
514 /*@}*/ |
3565ee7a5dd3
[gaim-migrate @ 6760]
Christian Hammond <chipx86@chipx86.com>
parents:
6241
diff
changeset
|
515 |
3565ee7a5dd3
[gaim-migrate @ 6760]
Christian Hammond <chipx86@chipx86.com>
parents:
6241
diff
changeset
|
516 /**************************************************************************/ |
4514 | 517 /** @name UI Registration Functions */ |
518 /**************************************************************************/ | |
519 /*@{*/ | |
520 | |
521 /** | |
522 * Sets the UI operations structure to be used in all gaim file transfers. | |
523 * | |
6720
41120df7ed94
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6269
diff
changeset
|
524 * @param ops The UI operations structure. |
4514 | 525 */ |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
526 void gaim_xfers_set_ui_ops(GaimXferUiOps *ops); |
4514 | 527 |
528 /** | |
529 * Returns the UI operations structure to be used in all gaim file transfers. | |
530 * | |
531 * @return The UI operations structure. | |
532 */ | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
533 GaimXferUiOps *gaim_xfers_get_ui_ops(void); |
4514 | 534 |
535 /*@}*/ | |
536 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
537 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
538 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
539 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
540 |
4514 | 541 #endif /* _GAIM_FT_H_ */ |