comparison libpurple/ft.h @ 15823:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents 35fa1d1c4ef2
children 516f14bef90e
comparison
equal deleted inserted replaced
15822:84b0f9b23ede 15823:32c366eeeb99
1 /** 1 /**
2 * @file ft.h File Transfer API 2 * @file ft.h File Transfer API
3 * @ingroup core 3 * @ingroup core
4 * 4 *
5 * gaim 5 * purple
6 * 6 *
7 * Gaim is the legal property of its developers, whose names are too numerous 7 * Purple 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 8 * to list here. Please refer to the COPYRIGHT file distributed with this
9 * source distribution. 9 * source distribution.
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 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 12 * it under the terms of the GNU General Public License as published by
22 * along with this program; if not, write to the Free Software 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 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 * 24 *
25 * @see @ref xfer-signals 25 * @see @ref xfer-signals
26 */ 26 */
27 #ifndef _GAIM_FT_H_ 27 #ifndef _PURPLE_FT_H_
28 #define _GAIM_FT_H_ 28 #define _PURPLE_FT_H_
29 29
30 /**************************************************************************/ 30 /**************************************************************************/
31 /** Data Structures */ 31 /** Data Structures */
32 /**************************************************************************/ 32 /**************************************************************************/
33 typedef struct _GaimXfer GaimXfer; 33 typedef struct _PurpleXfer PurpleXfer;
34 34
35 #include <glib.h> 35 #include <glib.h>
36 #include <stdio.h> 36 #include <stdio.h>
37 37
38 #include "account.h" 38 #include "account.h"
40 /** 40 /**
41 * Types of file transfers. 41 * Types of file transfers.
42 */ 42 */
43 typedef enum 43 typedef enum
44 { 44 {
45 GAIM_XFER_UNKNOWN = 0, /**< Unknown file transfer type. */ 45 PURPLE_XFER_UNKNOWN = 0, /**< Unknown file transfer type. */
46 GAIM_XFER_SEND, /**< File sending. */ 46 PURPLE_XFER_SEND, /**< File sending. */
47 GAIM_XFER_RECEIVE /**< File receiving. */ 47 PURPLE_XFER_RECEIVE /**< File receiving. */
48 48
49 } GaimXferType; 49 } PurpleXferType;
50 50
51 /** 51 /**
52 * The different states of the xfer. 52 * The different states of the xfer.
53 */ 53 */
54 typedef enum 54 typedef enum
55 { 55 {
56 GAIM_XFER_STATUS_UNKNOWN = 0, /**< Unknown, the xfer may be null. */ 56 PURPLE_XFER_STATUS_UNKNOWN = 0, /**< Unknown, the xfer may be null. */
57 GAIM_XFER_STATUS_NOT_STARTED, /**< It hasn't started yet. */ 57 PURPLE_XFER_STATUS_NOT_STARTED, /**< It hasn't started yet. */
58 GAIM_XFER_STATUS_ACCEPTED, /**< Receive accepted, but destination file not selected yet */ 58 PURPLE_XFER_STATUS_ACCEPTED, /**< Receive accepted, but destination file not selected yet */
59 GAIM_XFER_STATUS_STARTED, /**< gaim_xfer_start has been called. */ 59 PURPLE_XFER_STATUS_STARTED, /**< purple_xfer_start has been called. */
60 GAIM_XFER_STATUS_DONE, /**< The xfer completed successfully. */ 60 PURPLE_XFER_STATUS_DONE, /**< The xfer completed successfully. */
61 GAIM_XFER_STATUS_CANCEL_LOCAL, /**< The xfer was canceled by us. */ 61 PURPLE_XFER_STATUS_CANCEL_LOCAL, /**< The xfer was canceled by us. */
62 GAIM_XFER_STATUS_CANCEL_REMOTE /**< The xfer was canceled by the other end, or we couldn't connect. */ 62 PURPLE_XFER_STATUS_CANCEL_REMOTE /**< The xfer was canceled by the other end, or we couldn't connect. */
63 } GaimXferStatusType; 63 } PurpleXferStatusType;
64 64
65 /** 65 /**
66 * File transfer UI operations. 66 * File transfer UI operations.
67 * 67 *
68 * Any UI representing a file transfer must assign a filled-out 68 * Any UI representing a file transfer must assign a filled-out
69 * GaimXferUiOps structure to the gaim_xfer. 69 * PurpleXferUiOps structure to the purple_xfer.
70 */ 70 */
71 typedef struct 71 typedef struct
72 { 72 {
73 void (*new_xfer)(GaimXfer *xfer); 73 void (*new_xfer)(PurpleXfer *xfer);
74 void (*destroy)(GaimXfer *xfer); 74 void (*destroy)(PurpleXfer *xfer);
75 void (*add_xfer)(GaimXfer *xfer); 75 void (*add_xfer)(PurpleXfer *xfer);
76 void (*update_progress)(GaimXfer *xfer, double percent); 76 void (*update_progress)(PurpleXfer *xfer, double percent);
77 void (*cancel_local)(GaimXfer *xfer); 77 void (*cancel_local)(PurpleXfer *xfer);
78 void (*cancel_remote)(GaimXfer *xfer); 78 void (*cancel_remote)(PurpleXfer *xfer);
79 79
80 } GaimXferUiOps; 80 } PurpleXferUiOps;
81 81
82 /** 82 /**
83 * A core representation of a file transfer. 83 * A core representation of a file transfer.
84 */ 84 */
85 struct _GaimXfer 85 struct _PurpleXfer
86 { 86 {
87 guint ref; /**< The reference count. */ 87 guint ref; /**< The reference count. */
88 GaimXferType type; /**< The type of transfer. */ 88 PurpleXferType type; /**< The type of transfer. */
89 89
90 GaimAccount *account; /**< The account. */ 90 PurpleAccount *account; /**< The account. */
91 91
92 char *who; /**< The person on the other end of the 92 char *who; /**< The person on the other end of the
93 transfer. */ 93 transfer. */
94 94
95 char *message; /**< A message sent with the request */ 95 char *message; /**< A message sent with the request */
112 time_t end_time; /**< When the transfer of data ended. */ 112 time_t end_time; /**< When the transfer of data ended. */
113 113
114 size_t current_buffer_size; /**< This gradually increases for fast 114 size_t current_buffer_size; /**< This gradually increases for fast
115 network connections. */ 115 network connections. */
116 116
117 GaimXferStatusType status; /**< File Transfer's status. */ 117 PurpleXferStatusType status; /**< File Transfer's status. */
118 118
119 /* I/O operations. */ 119 /* I/O operations. */
120 struct 120 struct
121 { 121 {
122 void (*init)(GaimXfer *xfer); 122 void (*init)(PurpleXfer *xfer);
123 void (*request_denied)(GaimXfer *xfer); 123 void (*request_denied)(PurpleXfer *xfer);
124 void (*start)(GaimXfer *xfer); 124 void (*start)(PurpleXfer *xfer);
125 void (*end)(GaimXfer *xfer); 125 void (*end)(PurpleXfer *xfer);
126 void (*cancel_send)(GaimXfer *xfer); 126 void (*cancel_send)(PurpleXfer *xfer);
127 void (*cancel_recv)(GaimXfer *xfer); 127 void (*cancel_recv)(PurpleXfer *xfer);
128 gssize (*read)(guchar **buffer, GaimXfer *xfer); 128 gssize (*read)(guchar **buffer, PurpleXfer *xfer);
129 gssize (*write)(const guchar *buffer, size_t size, GaimXfer *xfer); 129 gssize (*write)(const guchar *buffer, size_t size, PurpleXfer *xfer);
130 void (*ack)(GaimXfer *xfer, const guchar *buffer, size_t size); 130 void (*ack)(PurpleXfer *xfer, const guchar *buffer, size_t size);
131 131
132 } ops; 132 } ops;
133 133
134 GaimXferUiOps *ui_ops; /**< UI-specific operations. */ 134 PurpleXferUiOps *ui_ops; /**< UI-specific operations. */
135 void *ui_data; /**< UI-specific data. */ 135 void *ui_data; /**< UI-specific data. */
136 136
137 void *data; /**< prpl-specific data. */ 137 void *data; /**< prpl-specific data. */
138 }; 138 };
139 139
149 /** 149 /**
150 * Creates a new file transfer handle. 150 * Creates a new file transfer handle.
151 * This is called by prpls. 151 * This is called by prpls.
152 * The handle starts with a ref count of 1, and this reference 152 * The handle starts with a ref count of 1, and this reference
153 * is owned by the core. The prpl normally does not need to 153 * is owned by the core. The prpl normally does not need to
154 * gaim_xfer_ref or unref. 154 * purple_xfer_ref or unref.
155 * 155 *
156 * @param account The account sending or receiving the file. 156 * @param account The account sending or receiving the file.
157 * @param type The type of file transfer. 157 * @param type The type of file transfer.
158 * @param who The name of the remote user. 158 * @param who The name of the remote user.
159 * 159 *
160 * @return A file transfer handle. 160 * @return A file transfer handle.
161 */ 161 */
162 GaimXfer *gaim_xfer_new(GaimAccount *account, 162 PurpleXfer *purple_xfer_new(PurpleAccount *account,
163 GaimXferType type, const char *who); 163 PurpleXferType type, const char *who);
164 164
165 /** 165 /**
166 * Returns all xfers 166 * Returns all xfers
167 * 167 *
168 * @return all current xfers with refs 168 * @return all current xfers with refs
169 */ 169 */
170 GList *gaim_xfers_get_all(void); 170 GList *purple_xfers_get_all(void);
171 171
172 /** 172 /**
173 * Increases the reference count on a GaimXfer. 173 * Increases the reference count on a PurpleXfer.
174 * Please call gaim_xfer_unref later. 174 * Please call purple_xfer_unref later.
175 * 175 *
176 * @param xfer A file transfer handle. 176 * @param xfer A file transfer handle.
177 */ 177 */
178 void gaim_xfer_ref(GaimXfer *xfer); 178 void purple_xfer_ref(PurpleXfer *xfer);
179 179
180 /** 180 /**
181 * Decreases the reference count on a GaimXfer. 181 * Decreases the reference count on a PurpleXfer.
182 * If the reference reaches 0, gaim_xfer_destroy (an internal function) 182 * If the reference reaches 0, purple_xfer_destroy (an internal function)
183 * will destroy the xfer. It calls the ui destroy cb first. 183 * will destroy the xfer. It calls the ui destroy cb first.
184 * Since the core keeps a ref on the xfer, only an erroneous call to 184 * Since the core keeps a ref on the xfer, only an erroneous call to
185 * this function will destroy the xfer while still in use. 185 * this function will destroy the xfer while still in use.
186 * 186 *
187 * @param xfer A file transfer handle. 187 * @param xfer A file transfer handle.
188 */ 188 */
189 void gaim_xfer_unref(GaimXfer *xfer); 189 void purple_xfer_unref(PurpleXfer *xfer);
190 190
191 /** 191 /**
192 * Requests confirmation for a file transfer from the user. If receiving 192 * Requests confirmation for a file transfer from the user. If receiving
193 * a file which is known at this point, this requests user to accept and 193 * a file which is known at this point, this requests user to accept and
194 * save the file. If the filename is unknown (not set) this only requests user 194 * save the file. If the filename is unknown (not set) this only requests user
195 * to accept the file transfer. In this case protocol must call this function 195 * to accept the file transfer. In this case protocol must call this function
196 * again once the filename is available. 196 * again once the filename is available.
197 * 197 *
198 * @param xfer The file transfer to request confirmation on. 198 * @param xfer The file transfer to request confirmation on.
199 */ 199 */
200 void gaim_xfer_request(GaimXfer *xfer); 200 void purple_xfer_request(PurpleXfer *xfer);
201 201
202 /** 202 /**
203 * Called if the user accepts the file transfer request. 203 * Called if the user accepts the file transfer request.
204 * 204 *
205 * @param xfer The file transfer. 205 * @param xfer The file transfer.
206 * @param filename The filename. 206 * @param filename The filename.
207 */ 207 */
208 void gaim_xfer_request_accepted(GaimXfer *xfer, const char *filename); 208 void purple_xfer_request_accepted(PurpleXfer *xfer, const char *filename);
209 209
210 /** 210 /**
211 * Called if the user rejects the file transfer request. 211 * Called if the user rejects the file transfer request.
212 * 212 *
213 * @param xfer The file transfer. 213 * @param xfer The file transfer.
214 */ 214 */
215 void gaim_xfer_request_denied(GaimXfer *xfer); 215 void purple_xfer_request_denied(PurpleXfer *xfer);
216 216
217 /** 217 /**
218 * Returns the type of file transfer. 218 * Returns the type of file transfer.
219 * 219 *
220 * @param xfer The file transfer. 220 * @param xfer The file transfer.
221 * 221 *
222 * @return The type of the file transfer. 222 * @return The type of the file transfer.
223 */ 223 */
224 GaimXferType gaim_xfer_get_type(const GaimXfer *xfer); 224 PurpleXferType purple_xfer_get_type(const PurpleXfer *xfer);
225 225
226 /** 226 /**
227 * Returns the account the file transfer is using. 227 * Returns the account the file transfer is using.
228 * 228 *
229 * @param xfer The file transfer. 229 * @param xfer The file transfer.
230 * 230 *
231 * @return The account. 231 * @return The account.
232 */ 232 */
233 GaimAccount *gaim_xfer_get_account(const GaimXfer *xfer); 233 PurpleAccount *purple_xfer_get_account(const PurpleXfer *xfer);
234 234
235 /** 235 /**
236 * Returns the status of the xfer. 236 * Returns the status of the xfer.
237 * 237 *
238 * @param xfer The file transfer. 238 * @param xfer The file transfer.
239 * 239 *
240 * @return The status. 240 * @return The status.
241 */ 241 */
242 GaimXferStatusType gaim_xfer_get_status(const GaimXfer *xfer); 242 PurpleXferStatusType purple_xfer_get_status(const PurpleXfer *xfer);
243 243
244 /** 244 /**
245 * Returns true if the file transfer was canceled. 245 * Returns true if the file transfer was canceled.
246 * 246 *
247 * @param xfer The file transfer. 247 * @param xfer The file transfer.
248 * 248 *
249 * @return Whether or not the transfer was canceled. 249 * @return Whether or not the transfer was canceled.
250 */ 250 */
251 gboolean gaim_xfer_is_canceled(const GaimXfer *xfer); 251 gboolean purple_xfer_is_canceled(const PurpleXfer *xfer);
252 252
253 /** 253 /**
254 * Returns the completed state for a file transfer. 254 * Returns the completed state for a file transfer.
255 * 255 *
256 * @param xfer The file transfer. 256 * @param xfer The file transfer.
257 * 257 *
258 * @return The completed state. 258 * @return The completed state.
259 */ 259 */
260 gboolean gaim_xfer_is_completed(const GaimXfer *xfer); 260 gboolean purple_xfer_is_completed(const PurpleXfer *xfer);
261 261
262 /** 262 /**
263 * Returns the name of the file being sent or received. 263 * Returns the name of the file being sent or received.
264 * 264 *
265 * @param xfer The file transfer. 265 * @param xfer The file transfer.
266 * 266 *
267 * @return The filename. 267 * @return The filename.
268 */ 268 */
269 const char *gaim_xfer_get_filename(const GaimXfer *xfer); 269 const char *purple_xfer_get_filename(const PurpleXfer *xfer);
270 270
271 /** 271 /**
272 * Returns the file's destination filename, 272 * Returns the file's destination filename,
273 * 273 *
274 * @param xfer The file transfer. 274 * @param xfer The file transfer.
275 * 275 *
276 * @return The destination filename. 276 * @return The destination filename.
277 */ 277 */
278 const char *gaim_xfer_get_local_filename(const GaimXfer *xfer); 278 const char *purple_xfer_get_local_filename(const PurpleXfer *xfer);
279 279
280 /** 280 /**
281 * Returns the number of bytes sent (or received) so far. 281 * Returns the number of bytes sent (or received) so far.
282 * 282 *
283 * @param xfer The file transfer. 283 * @param xfer The file transfer.
284 * 284 *
285 * @return The number of bytes sent. 285 * @return The number of bytes sent.
286 */ 286 */
287 size_t gaim_xfer_get_bytes_sent(const GaimXfer *xfer); 287 size_t purple_xfer_get_bytes_sent(const PurpleXfer *xfer);
288 288
289 /** 289 /**
290 * Returns the number of bytes remaining to send or receive. 290 * Returns the number of bytes remaining to send or receive.
291 * 291 *
292 * @param xfer The file transfer. 292 * @param xfer The file transfer.
293 * 293 *
294 * @return The number of bytes remaining. 294 * @return The number of bytes remaining.
295 */ 295 */
296 size_t gaim_xfer_get_bytes_remaining(const GaimXfer *xfer); 296 size_t purple_xfer_get_bytes_remaining(const PurpleXfer *xfer);
297 297
298 /** 298 /**
299 * Returns the size of the file being sent or received. 299 * Returns the size of the file being sent or received.
300 * 300 *
301 * @param xfer The file transfer. 301 * @param xfer The file transfer.
302 * 302 *
303 * @return The total size of the file. 303 * @return The total size of the file.
304 */ 304 */
305 size_t gaim_xfer_get_size(const GaimXfer *xfer); 305 size_t purple_xfer_get_size(const PurpleXfer *xfer);
306 306
307 /** 307 /**
308 * Returns the current percentage of progress of the transfer. 308 * Returns the current percentage of progress of the transfer.
309 * 309 *
310 * This is a number between 0 (0%) and 1 (100%). 310 * This is a number between 0 (0%) and 1 (100%).
311 * 311 *
312 * @param xfer The file transfer. 312 * @param xfer The file transfer.
313 * 313 *
314 * @return The percentage complete. 314 * @return The percentage complete.
315 */ 315 */
316 double gaim_xfer_get_progress(const GaimXfer *xfer); 316 double purple_xfer_get_progress(const PurpleXfer *xfer);
317 317
318 /** 318 /**
319 * Returns the local port number in the file transfer. 319 * Returns the local port number in the file transfer.
320 * 320 *
321 * @param xfer The file transfer. 321 * @param xfer The file transfer.
322 * 322 *
323 * @return The port number on this end. 323 * @return The port number on this end.
324 */ 324 */
325 unsigned int gaim_xfer_get_local_port(const GaimXfer *xfer); 325 unsigned int purple_xfer_get_local_port(const PurpleXfer *xfer);
326 326
327 /** 327 /**
328 * Returns the remote IP address in the file transfer. 328 * Returns the remote IP address in the file transfer.
329 * 329 *
330 * @param xfer The file transfer. 330 * @param xfer The file transfer.
331 * 331 *
332 * @return The IP address on the other end. 332 * @return The IP address on the other end.
333 */ 333 */
334 const char *gaim_xfer_get_remote_ip(const GaimXfer *xfer); 334 const char *purple_xfer_get_remote_ip(const PurpleXfer *xfer);
335 335
336 /** 336 /**
337 * Returns the remote port number in the file transfer. 337 * Returns the remote port number in the file transfer.
338 * 338 *
339 * @param xfer The file transfer. 339 * @param xfer The file transfer.
340 * 340 *
341 * @return The port number on the other end. 341 * @return The port number on the other end.
342 */ 342 */
343 unsigned int gaim_xfer_get_remote_port(const GaimXfer *xfer); 343 unsigned int purple_xfer_get_remote_port(const PurpleXfer *xfer);
344 344
345 /** 345 /**
346 * Sets the completed state for the file transfer. 346 * Sets the completed state for the file transfer.
347 * 347 *
348 * @param xfer The file transfer. 348 * @param xfer The file transfer.
349 * @param completed The completed state. 349 * @param completed The completed state.
350 */ 350 */
351 void gaim_xfer_set_completed(GaimXfer *xfer, gboolean completed); 351 void purple_xfer_set_completed(PurpleXfer *xfer, gboolean completed);
352 352
353 /** 353 /**
354 * Sets the filename for the file transfer. 354 * Sets the filename for the file transfer.
355 * 355 *
356 * @param xfer The file transfer. 356 * @param xfer The file transfer.
357 * @param message The message. 357 * @param message The message.
358 */ 358 */
359 void gaim_xfer_set_message(GaimXfer *xfer, const char *message); 359 void purple_xfer_set_message(PurpleXfer *xfer, const char *message);
360 360
361 /** 361 /**
362 * Sets the filename for the file transfer. 362 * Sets the filename for the file transfer.
363 * 363 *
364 * @param xfer The file transfer. 364 * @param xfer The file transfer.
365 * @param filename The filename. 365 * @param filename The filename.
366 */ 366 */
367 void gaim_xfer_set_filename(GaimXfer *xfer, const char *filename); 367 void purple_xfer_set_filename(PurpleXfer *xfer, const char *filename);
368 368
369 /** 369 /**
370 * Sets the local filename for the file transfer. 370 * Sets the local filename for the file transfer.
371 * 371 *
372 * @param xfer The file transfer. 372 * @param xfer The file transfer.
373 * @param filename The filename 373 * @param filename The filename
374 */ 374 */
375 void gaim_xfer_set_local_filename(GaimXfer *xfer, const char *filename); 375 void purple_xfer_set_local_filename(PurpleXfer *xfer, const char *filename);
376 376
377 /** 377 /**
378 * Sets the size of the file in a file transfer. 378 * Sets the size of the file in a file transfer.
379 * 379 *
380 * @param xfer The file transfer. 380 * @param xfer The file transfer.
381 * @param size The size of the file. 381 * @param size The size of the file.
382 */ 382 */
383 void gaim_xfer_set_size(GaimXfer *xfer, size_t size); 383 void purple_xfer_set_size(PurpleXfer *xfer, size_t size);
384 384
385 /** 385 /**
386 * Sets the current working position in the active file transfer. This 386 * Sets the current working position in the active file transfer. This
387 * can be used to jump backward in the file if the protocol detects 387 * can be used to jump backward in the file if the protocol detects
388 * that some bit of data needs to be resent or has been sent twice. 388 * that some bit of data needs to be resent or has been sent twice.
393 * @param bytes_sent The new current position in the file. If we're 393 * @param bytes_sent The new current position in the file. If we're
394 * sending a file then this is the byte that we will 394 * sending a file then this is the byte that we will
395 * send. If we're receiving a file, this is the 395 * send. If we're receiving a file, this is the
396 * next byte that we expect to receive. 396 * next byte that we expect to receive.
397 */ 397 */
398 void gaim_xfer_set_bytes_sent(GaimXfer *xfer, size_t bytes_sent); 398 void purple_xfer_set_bytes_sent(PurpleXfer *xfer, size_t bytes_sent);
399 399
400 /** 400 /**
401 * Returns the UI operations structure for a file transfer. 401 * Returns the UI operations structure for a file transfer.
402 * 402 *
403 * @param xfer The file transfer. 403 * @param xfer The file transfer.
404 * 404 *
405 * @return The UI operations structure. 405 * @return The UI operations structure.
406 */ 406 */
407 GaimXferUiOps *gaim_xfer_get_ui_ops(const GaimXfer *xfer); 407 PurpleXferUiOps *purple_xfer_get_ui_ops(const PurpleXfer *xfer);
408 408
409 /** 409 /**
410 * Sets the read function for the file transfer. 410 * Sets the read function for the file transfer.
411 * 411 *
412 * @param xfer The file transfer. 412 * @param xfer The file transfer.
413 * @param fnc The read function. 413 * @param fnc The read function.
414 */ 414 */
415 void gaim_xfer_set_read_fnc(GaimXfer *xfer, 415 void purple_xfer_set_read_fnc(PurpleXfer *xfer,
416 gssize (*fnc)(guchar **, GaimXfer *)); 416 gssize (*fnc)(guchar **, PurpleXfer *));
417 417
418 /** 418 /**
419 * Sets the write function for the file transfer. 419 * Sets the write function for the file transfer.
420 * 420 *
421 * @param xfer The file transfer. 421 * @param xfer The file transfer.
422 * @param fnc The write function. 422 * @param fnc The write function.
423 */ 423 */
424 void gaim_xfer_set_write_fnc(GaimXfer *xfer, 424 void purple_xfer_set_write_fnc(PurpleXfer *xfer,
425 gssize (*fnc)(const guchar *, size_t, GaimXfer *)); 425 gssize (*fnc)(const guchar *, size_t, PurpleXfer *));
426 426
427 /** 427 /**
428 * Sets the acknowledge function for the file transfer. 428 * Sets the acknowledge function for the file transfer.
429 * 429 *
430 * @param xfer The file transfer. 430 * @param xfer The file transfer.
431 * @param fnc The acknowledge function. 431 * @param fnc The acknowledge function.
432 */ 432 */
433 void gaim_xfer_set_ack_fnc(GaimXfer *xfer, 433 void purple_xfer_set_ack_fnc(PurpleXfer *xfer,
434 void (*fnc)(GaimXfer *, const guchar *, size_t)); 434 void (*fnc)(PurpleXfer *, const guchar *, size_t));
435 435
436 /** 436 /**
437 * Sets the function to be called if the request is denied. 437 * Sets the function to be called if the request is denied.
438 * 438 *
439 * @param xfer The file transfer. 439 * @param xfer The file transfer.
440 * @param fnc The request denied prpl callback. 440 * @param fnc The request denied prpl callback.
441 */ 441 */
442 void gaim_xfer_set_request_denied_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); 442 void purple_xfer_set_request_denied_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *));
443 443
444 /** 444 /**
445 * Sets the transfer initialization function for the file transfer. 445 * Sets the transfer initialization function for the file transfer.
446 * 446 *
447 * This function is required, and must call gaim_xfer_start() with 447 * This function is required, and must call purple_xfer_start() with
448 * the necessary parameters. This will be called if the file transfer 448 * the necessary parameters. This will be called if the file transfer
449 * is accepted by the user. 449 * is accepted by the user.
450 * 450 *
451 * @param xfer The file transfer. 451 * @param xfer The file transfer.
452 * @param fnc The transfer initialization function. 452 * @param fnc The transfer initialization function.
453 */ 453 */
454 void gaim_xfer_set_init_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); 454 void purple_xfer_set_init_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *));
455 455
456 /** 456 /**
457 * Sets the start transfer function for the file transfer. 457 * Sets the start transfer function for the file transfer.
458 * 458 *
459 * @param xfer The file transfer. 459 * @param xfer The file transfer.
460 * @param fnc The start transfer function. 460 * @param fnc The start transfer function.
461 */ 461 */
462 void gaim_xfer_set_start_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); 462 void purple_xfer_set_start_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *));
463 463
464 /** 464 /**
465 * Sets the end transfer function for the file transfer. 465 * Sets the end transfer function for the file transfer.
466 * 466 *
467 * @param xfer The file transfer. 467 * @param xfer The file transfer.
468 * @param fnc The end transfer function. 468 * @param fnc The end transfer function.
469 */ 469 */
470 void gaim_xfer_set_end_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); 470 void purple_xfer_set_end_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *));
471 471
472 /** 472 /**
473 * Sets the cancel send function for the file transfer. 473 * Sets the cancel send function for the file transfer.
474 * 474 *
475 * @param xfer The file transfer. 475 * @param xfer The file transfer.
476 * @param fnc The cancel send function. 476 * @param fnc The cancel send function.
477 */ 477 */
478 void gaim_xfer_set_cancel_send_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); 478 void purple_xfer_set_cancel_send_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *));
479 479
480 /** 480 /**
481 * Sets the cancel receive function for the file transfer. 481 * Sets the cancel receive function for the file transfer.
482 * 482 *
483 * @param xfer The file transfer. 483 * @param xfer The file transfer.
484 * @param fnc The cancel receive function. 484 * @param fnc The cancel receive function.
485 */ 485 */
486 void gaim_xfer_set_cancel_recv_fnc(GaimXfer *xfer, void (*fnc)(GaimXfer *)); 486 void purple_xfer_set_cancel_recv_fnc(PurpleXfer *xfer, void (*fnc)(PurpleXfer *));
487 487
488 /** 488 /**
489 * Reads in data from a file transfer stream. 489 * Reads in data from a file transfer stream.
490 * 490 *
491 * @param xfer The file transfer. 491 * @param xfer The file transfer.
492 * @param buffer The buffer that will be created to contain the data. 492 * @param buffer The buffer that will be created to contain the data.
493 * 493 *
494 * @return The number of bytes read, or -1. 494 * @return The number of bytes read, or -1.
495 */ 495 */
496 gssize gaim_xfer_read(GaimXfer *xfer, guchar **buffer); 496 gssize purple_xfer_read(PurpleXfer *xfer, guchar **buffer);
497 497
498 /** 498 /**
499 * Writes data to a file transfer stream. 499 * Writes data to a file transfer stream.
500 * 500 *
501 * @param xfer The file transfer. 501 * @param xfer The file transfer.
502 * @param buffer The buffer to read the data from. 502 * @param buffer The buffer to read the data from.
503 * @param size The number of bytes to write. 503 * @param size The number of bytes to write.
504 * 504 *
505 * @return The number of bytes written, or -1. 505 * @return The number of bytes written, or -1.
506 */ 506 */
507 gssize gaim_xfer_write(GaimXfer *xfer, const guchar *buffer, gsize size); 507 gssize purple_xfer_write(PurpleXfer *xfer, const guchar *buffer, gsize size);
508 508
509 /** 509 /**
510 * Starts a file transfer. 510 * Starts a file transfer.
511 * 511 *
512 * Either @a fd must be specified <i>or</i> @a ip and @a port on a 512 * Either @a fd must be specified <i>or</i> @a ip and @a port on a
516 * @param xfer The file transfer. 516 * @param xfer The file transfer.
517 * @param fd The file descriptor for the socket. 517 * @param fd The file descriptor for the socket.
518 * @param ip The IP address to connect to. 518 * @param ip The IP address to connect to.
519 * @param port The port to connect to. 519 * @param port The port to connect to.
520 */ 520 */
521 void gaim_xfer_start(GaimXfer *xfer, int fd, const char *ip, 521 void purple_xfer_start(PurpleXfer *xfer, int fd, const char *ip,
522 unsigned int port); 522 unsigned int port);
523 523
524 /** 524 /**
525 * Ends a file transfer. 525 * Ends a file transfer.
526 * 526 *
527 * @param xfer The file transfer. 527 * @param xfer The file transfer.
528 */ 528 */
529 void gaim_xfer_end(GaimXfer *xfer); 529 void purple_xfer_end(PurpleXfer *xfer);
530 530
531 /** 531 /**
532 * Adds a new file transfer to the list of file transfers. Call this only 532 * Adds a new file transfer to the list of file transfers. Call this only
533 * if you are not using gaim_xfer_start. 533 * if you are not using purple_xfer_start.
534 * 534 *
535 * @param xfer The file transfer. 535 * @param xfer The file transfer.
536 */ 536 */
537 void gaim_xfer_add(GaimXfer *xfer); 537 void purple_xfer_add(PurpleXfer *xfer);
538 538
539 /** 539 /**
540 * Cancels a file transfer on the local end. 540 * Cancels a file transfer on the local end.
541 * 541 *
542 * @param xfer The file transfer. 542 * @param xfer The file transfer.
543 */ 543 */
544 void gaim_xfer_cancel_local(GaimXfer *xfer); 544 void purple_xfer_cancel_local(PurpleXfer *xfer);
545 545
546 /** 546 /**
547 * Cancels a file transfer from the remote end. 547 * Cancels a file transfer from the remote end.
548 * 548 *
549 * @param xfer The file transfer. 549 * @param xfer The file transfer.
550 */ 550 */
551 void gaim_xfer_cancel_remote(GaimXfer *xfer); 551 void purple_xfer_cancel_remote(PurpleXfer *xfer);
552 552
553 /** 553 /**
554 * Displays a file transfer-related error message. 554 * Displays a file transfer-related error message.
555 * 555 *
556 * This is a wrapper around gaim_notify_error(), which automatically 556 * This is a wrapper around purple_notify_error(), which automatically
557 * specifies a title ("File transfer to <i>user</i> failed" or 557 * specifies a title ("File transfer to <i>user</i> failed" or
558 * "File Transfer from <i>user</i> failed"). 558 * "File Transfer from <i>user</i> failed").
559 * 559 *
560 * @param type The type of file transfer. 560 * @param type The type of file transfer.
561 * @param account The account sending or receiving the file. 561 * @param account The account sending or receiving the file.
562 * @param who The user on the other end of the transfer. 562 * @param who The user on the other end of the transfer.
563 * @param msg The message to display. 563 * @param msg The message to display.
564 */ 564 */
565 void gaim_xfer_error(GaimXferType type, GaimAccount *account, const char *who, const char *msg); 565 void purple_xfer_error(PurpleXferType type, PurpleAccount *account, const char *who, const char *msg);
566 566
567 /** 567 /**
568 * Updates file transfer progress. 568 * Updates file transfer progress.
569 * 569 *
570 * @param xfer The file transfer. 570 * @param xfer The file transfer.
571 */ 571 */
572 void gaim_xfer_update_progress(GaimXfer *xfer); 572 void purple_xfer_update_progress(PurpleXfer *xfer);
573 573
574 /** 574 /**
575 * Displays a file transfer-related message in the conversation window 575 * Displays a file transfer-related message in the conversation window
576 * 576 *
577 * This is a wrapper around gaim_conversation_write 577 * This is a wrapper around purple_conversation_write
578 * 578 *
579 * @param xfer The file transfer to which this message relates. 579 * @param xfer The file transfer to which this message relates.
580 * @param message The message to display. 580 * @param message The message to display.
581 * @param is_error Is this an error message?. 581 * @param is_error Is this an error message?.
582 */ 582 */
583 void gaim_xfer_conversation_write(GaimXfer *xfer, char *message, gboolean is_error); 583 void purple_xfer_conversation_write(PurpleXfer *xfer, char *message, gboolean is_error);
584 584
585 /*@}*/ 585 /*@}*/
586 586
587 /**************************************************************************/ 587 /**************************************************************************/
588 /** @name UI Registration Functions */ 588 /** @name UI Registration Functions */
592 /** 592 /**
593 * Returns the handle to the file transfer subsystem 593 * Returns the handle to the file transfer subsystem
594 * 594 *
595 * @return The handle 595 * @return The handle
596 */ 596 */
597 void *gaim_xfers_get_handle(void); 597 void *purple_xfers_get_handle(void);
598 598
599 /** 599 /**
600 * Initializes the file transfer subsystem 600 * Initializes the file transfer subsystem
601 */ 601 */
602 void gaim_xfers_init(void); 602 void purple_xfers_init(void);
603 603
604 /** 604 /**
605 * Uninitializes the file transfer subsystem 605 * Uninitializes the file transfer subsystem
606 */ 606 */
607 void gaim_xfers_uninit(void); 607 void purple_xfers_uninit(void);
608 608
609 /** 609 /**
610 * Sets the UI operations structure to be used in all gaim file transfers. 610 * Sets the UI operations structure to be used in all purple file transfers.
611 * 611 *
612 * @param ops The UI operations structure. 612 * @param ops The UI operations structure.
613 */ 613 */
614 void gaim_xfers_set_ui_ops(GaimXferUiOps *ops); 614 void purple_xfers_set_ui_ops(PurpleXferUiOps *ops);
615 615
616 /** 616 /**
617 * Returns the UI operations structure to be used in all gaim file transfers. 617 * Returns the UI operations structure to be used in all purple file transfers.
618 * 618 *
619 * @return The UI operations structure. 619 * @return The UI operations structure.
620 */ 620 */
621 GaimXferUiOps *gaim_xfers_get_ui_ops(void); 621 PurpleXferUiOps *purple_xfers_get_ui_ops(void);
622 622
623 /*@}*/ 623 /*@}*/
624 624
625 #ifdef __cplusplus 625 #ifdef __cplusplus
626 } 626 }
627 #endif 627 #endif
628 628
629 #endif /* _GAIM_FT_H_ */ 629 #endif /* _PURPLE_FT_H_ */