Set debugging enablement earlier so it can be used from thrasher_wrapper_init().
[thrasher.git] / thft.h
blobef298011e3c9c84f77bd3123ba6abcdf764dbed2
1 /*
2 * Thrasher Bird - XMPP transport via libpurple
3 * Copyright (C) 2008 Barracuda Networks, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Thrasher Bird; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
19 #ifndef THFT_H
20 #define THFT_H
22 typedef struct _Thrasher_Xfer_UI_Data {
23 size_t id;
24 char* filename; /* filename to send on network. owned. */
25 guint size;
26 char* desc; /* description/message to send with offer. owned. */
27 } Thrasher_Xfer_UI_Data;
29 void thrasher_xfer_init(void);
31 // Thrasher bookkeeping
32 void free_id (gpointer id);
33 size_t get_next_file_transfer_id(void);
34 PurpleXfer* get_xfer_by_id(guint id);
35 guint get_id_by_xfer(PurpleXfer* xfer);
36 void thrasher_remove_xfer(PurpleXfer *xfer);
37 void thrasher_xfer_destroy(guint id);
38 int store_xfer(PurpleXfer *xfer);
40 // Callbacks
41 void thrasher_xfer_recv_request_cb(PurpleXfer *xfer, gpointer data);
42 void thrasher_xfer_recv_accept_cb(PurpleXfer *xfer, gpointer data);
43 void thrasher_xfer_recv_start_cb(PurpleXfer *xfer, gpointer data);
44 void thrasher_xfer_recv_cancel_cb(PurpleXfer *xfer, gpointer data);
45 void thrasher_xfer_recv_complete_cb(PurpleXfer *xfer, gpointer data);
46 void thrasher_xfer_send_accept_cb(PurpleXfer *xfer, gpointer data);
47 void thrasher_xfer_send_start_cb(PurpleXfer *xfer, gpointer data);
48 void thrasher_xfer_send_cancel_cb(PurpleXfer *xfer, gpointer data);
49 void thrasher_xfer_send_complete_cb(PurpleXfer *xfer, gpointer data);
51 // UI Ops
52 void thrasher_new_xfer(PurpleXfer *xfer);
53 void thrasher_destroy_xfer(PurpleXfer *xfer);
54 void thrasher_add_xfer(PurpleXfer *xfer);
55 void thrasher_update_xfer_progress(PurpleXfer *xfer, double percent);
56 void thrasher_xfer_cancel_local(PurpleXfer *xfer);
57 void thrasher_xfer_cancel_remote(PurpleXfer *xfer);
58 gssize thrasher_ui_write(PurpleXfer *xfer, const guchar *buffer, gssize size);
59 gssize thrasher_ui_read(PurpleXfer *xfer, guchar **buffer, gssize size);
60 void thrasher_data_not_sent(PurpleXfer *xfer, const guchar *buffer, gsize size);
63 // Request UI ops
64 void *thrasher_request_file(const char *title, const char *filename,
65 gboolean savedialog, GCallback ok_cb,
66 GCallback cancel_cb,
67 PurpleAccount *account,
68 const char *who,
69 PurpleConversation *conv,
70 void *user_data);
72 // Perl hooks
73 size_t thrasher_send_file(PurpleAccount *account,
74 const char *who,
75 char *filename,
76 size_t size,
77 char *desc);
78 void thrasher_xfer_recv_request_responder(guint id, guint accept);
80 // Individual file transfer ops, which we are supposed to always
81 // set up.
82 void thrasher_xfer_individual_init(PurpleXfer *xfer);
83 void thrasher_xfer_request_denied(PurpleXfer *xfer);
84 void thrasher_xfer_start(PurpleXfer *xfer);
85 void thrasher_xfer_end(PurpleXfer *xfer);
86 void thrasher_xfer_cancel_send(PurpleXfer *xfer);
87 void thrasher_xfer_cancel_receive(PurpleXfer *xfer);
88 gssize thrasher_xfer_read(guchar **buffer, PurpleXfer *xfer);
89 gssize thrasher_xfer_write(const guchar *buffer, size_t size,
90 PurpleXfer *xfer);
91 void thrasher_xfer_ack(PurpleXfer *xfer, const guchar *buffer,
92 size_t size);
94 #endif