~vish/ubuntu/maverick/pidgin/bug25979

« back to all changes in this revision

Viewing changes to libpurple/protocols/jabber/caps.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-10-09 19:40:26 UTC
  • mfrom: (1.4.1 upstream) (46.1.10 karmic)
  • Revision ID: james.westby@ubuntu.com-20091009194026-wbqqh0bsbz19nx5q
Tags: 1:2.6.2-1ubuntu7
* Don't stick the buddy list window to all desktops as some
  window managers have trouble to properly unstick it (LP: #346840)
  - debian/patches/11_buddy_list_really_show.patch
* Always use default tray icon size on KDE (LP: #209440)
  - debian/patches/62_tray_icon_size_kde.patch
* Use scrollbars in the preferences dialog if the screen height is
  below 700 px instead of 600 px
  - debian/patches/60_1024x600_gtkprefs.c.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * purple - Jabber Protocol Plugin
3
3
 *
4
 
 * Copyright (C) 2007, Andreas Monitzer <andy@monitzer.com>
 
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
 
6
 * source distribution.
5
7
 *
6
8
 * This program is free software; you can redistribute it and/or modify
7
9
 * it under the terms of the GNU General Public License as published by
15
17
 *
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
19
21
 *
20
22
 */
21
23
 
22
 
#ifndef _PURPLE_JABBER_CAPS_H_
23
 
#define _PURPLE_JABBER_CAPS_H_
 
24
#ifndef PURPLE_JABBER_CAPS_H_
 
25
#define PURPLE_JABBER_CAPS_H_
24
26
 
25
27
typedef struct _JabberCapsClientInfo JabberCapsClientInfo;
26
28
 
27
29
#include "jabber.h"
28
30
 
29
 
/* Implementation of XEP-0115 */
30
 
 
31
 
typedef struct _JabberCapsIdentity {
32
 
        char *category;
33
 
        char *type;
34
 
        char *name;
35
 
} JabberCapsIdentity;
 
31
/* Implementation of XEP-0115 - Entity Capabilities */
 
32
 
 
33
typedef struct _JabberCapsNodeExts JabberCapsNodeExts;
 
34
 
 
35
typedef struct _JabberCapsTuple {
 
36
        const char *node;
 
37
        const char *ver;
 
38
        const char *hash;
 
39
} JabberCapsTuple;
36
40
 
37
41
struct _JabberCapsClientInfo {
38
 
        GList *identities; /* JabberCapsIdentity */
 
42
        GList *identities; /* JabberIdentity */
39
43
        GList *features; /* char * */
40
 
};
41
 
 
42
 
typedef void (*jabber_caps_get_info_cb)(JabberCapsClientInfo *info, gpointer user_data);
 
44
        GList *forms; /* xmlnode * */
 
45
        JabberCapsNodeExts *exts;
 
46
 
 
47
        const JabberCapsTuple tuple;
 
48
};
 
49
 
 
50
/*
 
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).
 
55
 *
 
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).
 
59
 *
 
60
 * It's only exposed so that jabber_resource_has_capability can use it.
 
61
 * Everyone else, STAY AWAY!
 
62
 */
 
63
struct _JabberCapsNodeExts {
 
64
        guint ref;
 
65
        GHashTable *exts; /* char *ext_name -> GList *features */
 
66
};
 
67
 
 
68
typedef void (*jabber_caps_get_info_cb)(JabberCapsClientInfo *info, GList *exts, gpointer user_data);
43
69
 
44
70
void jabber_caps_init(void);
45
 
 
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);
48
 
 
49
 
#endif /* _PURPLE_JABBER_CAPS_H_ */
 
71
void jabber_caps_uninit(void);
 
72
 
 
73
/**
 
74
 * Check whether all of the exts in a char* array are known to the given info.
 
75
 */
 
76
gboolean jabber_caps_exts_known(const JabberCapsClientInfo *info, char **exts);
 
77
 
 
78
/**
 
79
 * Main entity capabilites function to get the capabilities of a contact.
 
80
 *
 
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)
 
84
 *
 
85
 * @param exts A g_strsplit'd (NULL-terminated) array of strings. This
 
86
 *             function is responsible for freeing it.
 
87
 */
 
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,
 
91
                          gpointer user_data);
 
92
 
 
93
/**
 
94
 *      Takes a JabberCapsClientInfo pointer and returns the caps hash according to
 
95
 *      XEP-0115 Version 1.5.
 
96
 *
 
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
 
100
 */
 
101
gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, const char *hash);
 
102
 
 
103
/**
 
104
 *  Calculate SHA1 hash for own featureset.
 
105
 */
 
106
void jabber_caps_calculate_own_hash(JabberStream *js);
 
107
 
 
108
/** Get the current caps hash.
 
109
 *      @ret hash
 
110
**/
 
111
const gchar* jabber_caps_get_own_hash(JabberStream *js);
 
112
 
 
113
/**
 
114
 *  Broadcast a new calculated hash using a <presence> stanza.
 
115
 */
 
116
void jabber_caps_broadcast_change(void);
 
117
 
 
118
#endif /* PURPLE_JABBER_CAPS_H_ */