16
18
* You should have received a copy of the GNU General Public License
17
19
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22
#ifndef _PURPLE_JABBER_CAPS_H_
23
#define _PURPLE_JABBER_CAPS_H_
24
#ifndef PURPLE_JABBER_CAPS_H_
25
#define PURPLE_JABBER_CAPS_H_
25
27
typedef struct _JabberCapsClientInfo JabberCapsClientInfo;
27
29
#include "jabber.h"
29
/* Implementation of XEP-0115 */
31
typedef struct _JabberCapsIdentity {
31
/* Implementation of XEP-0115 - Entity Capabilities */
33
typedef struct _JabberCapsNodeExts JabberCapsNodeExts;
35
typedef struct _JabberCapsTuple {
37
41
struct _JabberCapsClientInfo {
38
GList *identities; /* JabberCapsIdentity */
42
GList *identities; /* JabberIdentity */
39
43
GList *features; /* char * */
42
typedef void (*jabber_caps_get_info_cb)(JabberCapsClientInfo *info, gpointer user_data);
44
GList *forms; /* xmlnode * */
45
JabberCapsNodeExts *exts;
47
const JabberCapsTuple tuple;
51
* This stores a set of exts "known" for a specific node (which indicates
52
* a specific client -- for reference, Pidgin, Finch, Meebo, et al share one
53
* node.) In XEP-0115 v1.3, exts are used for features that may or may not be
54
* present at a given time (PEP things, buzz might be disabled, etc).
56
* This structure is shared among all JabberCapsClientInfo instances matching
57
* a specific node (if the capstable key->hash == NULL, which indicates that
58
* the ClientInfo is using v1.3 caps as opposed to v1.5 caps).
60
* It's only exposed so that jabber_resource_has_capability can use it.
61
* Everyone else, STAY AWAY!
63
struct _JabberCapsNodeExts {
65
GHashTable *exts; /* char *ext_name -> GList *features */
68
typedef void (*jabber_caps_get_info_cb)(JabberCapsClientInfo *info, GList *exts, gpointer user_data);
44
70
void jabber_caps_init(void);
46
void jabber_caps_get_info(JabberStream *js, const char *who, const char *node, const char *ver, const char *ext, jabber_caps_get_info_cb cb, gpointer user_data);
47
void jabber_caps_free_clientinfo(JabberCapsClientInfo *clientinfo);
49
#endif /* _PURPLE_JABBER_CAPS_H_ */
71
void jabber_caps_uninit(void);
74
* Check whether all of the exts in a char* array are known to the given info.
76
gboolean jabber_caps_exts_known(const JabberCapsClientInfo *info, char **exts);
79
* Main entity capabilites function to get the capabilities of a contact.
81
* The callback will be called synchronously if we already have the
82
* capabilities for the specified (node,ver,hash) (and, if exts are specified,
83
* if we know what each means)
85
* @param exts A g_strsplit'd (NULL-terminated) array of strings. This
86
* function is responsible for freeing it.
88
void jabber_caps_get_info(JabberStream *js, const char *who, const char *node,
89
const char *ver, const char *hash,
90
char **exts, jabber_caps_get_info_cb cb,
94
* Takes a JabberCapsClientInfo pointer and returns the caps hash according to
95
* XEP-0115 Version 1.5.
97
* @param info A JabberCapsClientInfo pointer.
98
* @param hash Hash cipher to be used. Either sha-1 or md5.
99
* @return The base64 encoded SHA-1 hash; must be freed by caller
101
gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash);
104
* Calculate SHA1 hash for own featureset.
106
void jabber_caps_calculate_own_hash(JabberStream *js);
108
/** Get the current caps hash.
111
const gchar* jabber_caps_get_own_hash(JabberStream *js);
114
* Broadcast a new calculated hash using a <presence> stanza.
116
void jabber_caps_broadcast_change(void);
118
#endif /* PURPLE_JABBER_CAPS_H_ */