2 * purple - Handling of XEP-0231: Bits of Binary.
4 * Purple is the legal property of its developers, whose names are too numerous
5 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
24 #ifndef PURPLE_JABBER_DATA_H
25 #define PURPLE_JABBER_DATA_H
32 #define JABBER_DATA_MAX_SIZE 8192
43 typedef void (JabberDataRequestCallback
)(JabberData
*data
, gchar
*alt
,
47 /* creates a JabberData instance from raw data */
48 JabberData
*jabber_data_create_from_data(gconstpointer data
, gsize size
,
49 const char *type
, gboolean ephemeral
, JabberStream
*js
);
51 /* create a JabberData instance from an XML "data" element (as defined by
53 JabberData
*jabber_data_create_from_xml(PurpleXmlNode
*tag
);
55 /* destroy a JabberData instance, NOT to be used on data that has been
56 associated, since they get "owned" */
57 void jabber_data_destroy(JabberData
*data
);
59 const char *jabber_data_get_cid(const JabberData
*data
);
60 const char *jabber_data_get_type(const JabberData
*data
);
62 gsize
jabber_data_get_size(const JabberData
*data
);
63 gpointer
jabber_data_get_data(const JabberData
*data
);
65 /* returns the XML definition for the data element */
66 PurpleXmlNode
*jabber_data_get_xml_definition(const JabberData
*data
);
68 /* returns an XHTML-IM "img" tag given a data instance */
69 PurpleXmlNode
*jabber_data_get_xhtml_im(const JabberData
*data
, const gchar
*alt
);
71 void jabber_data_request(JabberStream
*js
, const gchar
*cid
, const gchar
*who
,
72 gchar
*alt
, gboolean ephemeral
, JabberDataRequestCallback cb
,
75 /* lookup functions */
76 const JabberData
*jabber_data_find_local_by_alt(const gchar
*alt
);
77 const JabberData
*jabber_data_find_local_by_cid(const gchar
*cid
);
78 const JabberData
*jabber_data_find_remote_by_cid(JabberStream
*js
,
79 const gchar
*who
, const gchar
*cid
);
81 /* store data objects */
82 void jabber_data_associate_local(JabberData
*data
, const gchar
*alt
);
83 void jabber_data_associate_remote(JabberStream
*js
, const gchar
*who
,
86 /* handles iq requests */
87 void jabber_data_parse(JabberStream
*js
, const char *who
, JabberIqType type
,
88 const char *id
, PurpleXmlNode
*data_node
);
90 void jabber_data_init(void);
91 void jabber_data_uninit(void);
93 #endif /* PURPLE_JABBER_DATA_H */