annotate libpurple/protocols/jabber/ibb.h @ 25989:035ba9355361

IBB is now in im.pidgin.pidgin
author Paul Aurich <paul@darkrain42.org>
date Sat, 07 Mar 2009 02:23:14 +0000
parents 5f9a24d1c25e
children 50ff0162fe26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
1 /*
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
2 * This program is free software; you can redistribute it and/or modify
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
3 * it under the terms of the GNU General Public License as published by
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
4 * the Free Software Foundation; either version 2 of the License, or
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
5 * (at your option) any later version.
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25247
diff changeset
6 *
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
7 * This program is distributed in the hope that it will be useful,
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
10 * GNU Library General Public License for more details.
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25247
diff changeset
11 *
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
12 * You should have received a copy of the GNU General Public License
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
13 * along with this program; if not, write to the Free Software
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
15 */
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25247
diff changeset
16
25247
151b4054ce40 Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents: 23999
diff changeset
17 #ifndef _PURPLE_JABBER_IBB_H_
151b4054ce40 Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents: 23999
diff changeset
18 #define _PURPLE_JABBER_IBB_H_
151b4054ce40 Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents: 23999
diff changeset
19
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
20 #include "jabber.h"
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
21 #include "iq.h"
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
22
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
23 #define XEP_0047_NAMESPACE "http://jabber.org/protocol/ibb"
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
24
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
25 typedef struct _JabberIBBSession JabberIBBSession;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
26
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25247
diff changeset
27 typedef void
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
28 (JabberIBBDataCallback)(JabberIBBSession *, const gpointer data, gsize size);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
29
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
30 typedef void (JabberIBBOpenedCallback)(JabberIBBSession *);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
31 typedef void (JabberIBBClosedCallback)(JabberIBBSession *);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
32 typedef void (JabberIBBErrorCallback)(JabberIBBSession *);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
33 typedef void (JabberIBBSentCallback)(JabberIBBSession *);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
34
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
35 typedef gboolean (JabberIBBOpenHandler)(JabberStream *js, xmlnode *packet);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
36
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
37 typedef enum {
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
38 JABBER_IBB_SESSION_NOT_OPENED,
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
39 JABBER_IBB_SESSION_OPENED,
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
40 JABBER_IBB_SESSION_CLOSED,
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
41 JABBER_IBB_SESSION_ERROR
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
42 } JabberIBBSessionState;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
43
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
44 struct _JabberIBBSession {
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
45 JabberStream *js;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
46 gchar *who;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
47 gchar *sid;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
48 gchar *id;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
49 guint16 send_seq;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
50 guint16 recv_seq;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
51 gsize block_size;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25247
diff changeset
52
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
53 /* session state */
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
54 JabberIBBSessionState state;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25247
diff changeset
55
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
56 /* user data (f.ex. a handle to a PurpleXfer) */
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
57 gpointer user_data;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25247
diff changeset
58
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
59 /* callbacks */
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
60 JabberIBBOpenedCallback *opened_cb;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
61 JabberIBBSentCallback *data_sent_cb;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
62 JabberIBBClosedCallback *closed_cb;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
63 /* callback for receiving data */
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
64 JabberIBBDataCallback *data_received_cb;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
65 JabberIBBErrorCallback *error_cb;
25443
5f9a24d1c25e Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25247
diff changeset
66
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
67 /* store the last sent IQ (to permit cancel of callback) */
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
68 gchar *last_iq_id;
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
69 };
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
70
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
71 JabberIBBSession *jabber_ibb_session_create(JabberStream *js, const gchar *sid,
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
72 const gchar *who, gpointer user_data);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
73 JabberIBBSession *jabber_ibb_session_create_from_xmlnode(JabberStream *js,
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
74 xmlnode *packet, gpointer user_data);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
75
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
76 void jabber_ibb_session_destroy(JabberIBBSession *sess);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
77
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
78 void jabber_ibb_session_set_opened_callback(JabberIBBSession *sess,
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
79 JabberIBBOpenedCallback *cb);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
80 void jabber_ibb_session_set_data_sent_callback(JabberIBBSession *sess,
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
81 JabberIBBSentCallback *cb);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
82 void jabber_ibb_session_set_closed_callback(JabberIBBSession *sess,
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
83 JabberIBBClosedCallback *cb);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
84 void jabber_ibb_session_set_data_received_callback(JabberIBBSession *sess,
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
85 JabberIBBDataCallback *cb);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
86 void jabber_ibb_session_set_error_callback(JabberIBBSession *sess,
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
87 JabberIBBErrorCallback *cb);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
88
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
89 void jabber_ibb_session_open(JabberIBBSession *sess);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
90 void jabber_ibb_session_close(JabberIBBSession *sess);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
91 void jabber_ibb_session_accept(JabberIBBSession *sess);
25247
151b4054ce40 Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents: 23999
diff changeset
92 void jabber_ibb_session_send_data(JabberIBBSession *sess, gconstpointer data,
23999
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
93 gsize size);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
94
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
95 const gchar *jabber_ibb_session_get_sid(const JabberIBBSession *sess);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
96 JabberStream *jabber_ibb_session_get_js(JabberIBBSession *sess);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
97 const gchar *jabber_ibb_session_get_who(const JabberIBBSession *sess);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
98
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
99 guint16 jabber_ibb_session_get_send_seq(const JabberIBBSession *sess);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
100 guint16 jabber_ibb_session_get_recv_seq(const JabberIBBSession *sess);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
101
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
102 JabberIBBSessionState jabber_ibb_session_get_state(const JabberIBBSession *sess);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
103
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
104 gsize jabber_ibb_session_get_block_size(const JabberIBBSession *sess);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
105 void jabber_ibb_session_set_block_size(JabberIBBSession *sess, gsize size);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
106
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
107 gpointer jabber_ibb_session_get_user_data(JabberIBBSession *sess);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
108
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
109 /* handle incoming packet */
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
110 void jabber_ibb_parse(JabberStream *js, xmlnode *packet);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
111
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
112 /* add a handler for open session */
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
113 void jabber_ibb_register_open_handler(JabberIBBOpenHandler *cb);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
114 void jabber_ibb_unregister_open_handler(JabberIBBOpenHandler *cb);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
115
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
116 void jabber_ibb_init(void);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
117 void jabber_ibb_uninit(void);
b4ec5481a67a Implements file transfers using in-band bytestreams for XMPP
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
118
25247
151b4054ce40 Trigger error callbacks when receiving a malformed-ish packet.
Paul Aurich <paul@darkrain42.org>
parents: 23999
diff changeset
119 #endif /* _PURPLE_JABBER_IBB_H_ */