libpurple/protocols/jabber/jabber.h

branch
cpw.darkrain42.xmpp.bosh
changeset 26072
e8fce2b2b9fe
parent 26042
4dabdb5fe213
parent 25482
d3ab10d1c900
child 26533
5c74696c34d1
equal deleted inserted replaced
26071:b4bbfacd7f20 26072:e8fce2b2b9fe
58 #include "sslconn.h" 58 #include "sslconn.h"
59 59
60 #include "jutil.h" 60 #include "jutil.h"
61 #include "xmlnode.h" 61 #include "xmlnode.h"
62 #include "buddy.h" 62 #include "buddy.h"
63 #include "bosh.h"
63 64
64 #ifdef HAVE_CYRUS_SASL 65 #ifdef HAVE_CYRUS_SASL
65 #include <sasl/sasl.h> 66 #include <sasl/sasl.h>
66 #endif 67 #endif
67 68
68 #define CAPS0115_NODE "http://pidgin.im/caps" 69 #define CAPS0115_NODE "http://pidgin.im/"
69 70
70 /* Index into attention_types list */ 71 /* Index into attention_types list */
71 #define JABBER_BUZZ 0 72 #define JABBER_BUZZ 0
72 73
73 typedef enum { 74 typedef enum {
204 PurpleAccountUnregistrationCb unregistration_cb; 205 PurpleAccountUnregistrationCb unregistration_cb;
205 void *unregistration_user_data; 206 void *unregistration_user_data;
206 207
207 gboolean vcard_fetched; 208 gboolean vcard_fetched;
208 209
210 /* Entity Capabilities hash */
211 char *caps_hash;
212
209 /* does the local server support PEP? */ 213 /* does the local server support PEP? */
210 gboolean pep; 214 gboolean pep;
211 215
212 /* Is Buzz enabled? */ 216 /* Is Buzz enabled? */
213 gboolean allowBuzz; 217 gboolean allowBuzz;
231 235
232 char *certificate_CN; 236 char *certificate_CN;
233 237
234 /* A purple timeout tag for the keepalive */ 238 /* A purple timeout tag for the keepalive */
235 int keepalive_timeout; 239 int keepalive_timeout;
236 240
237 PurpleSrvResponse *srv_rec; 241 PurpleSrvResponse *srv_rec;
238 guint srv_rec_idx; 242 guint srv_rec_idx;
239 guint max_srv_rec_idx; 243 guint max_srv_rec_idx;
244
245 /* BOSH stuff */
246 gboolean use_bosh;
247 PurpleBOSHConnection *bosh;
248
240 /** 249 /**
241 * This linked list contains PurpleUtilFetchUrlData structs 250 * This linked list contains PurpleUtilFetchUrlData structs
242 * for when we lookup buddy icons from a url 251 * for when we lookup buddy icons from a url
243 */ 252 */
244 GSList *url_datas; 253 GSList *url_datas;
245 }; 254 };
246 255
247 typedef gboolean (JabberFeatureEnabled)(JabberStream *js, const gchar *shortname, const gchar *namespace); 256 typedef gboolean (JabberFeatureEnabled)(JabberStream *js, const gchar *namespace);
248 257
249 typedef struct _JabberFeature 258 typedef struct _JabberFeature
250 { 259 {
251 gchar *shortname;
252 gchar *namespace; 260 gchar *namespace;
253 JabberFeatureEnabled *is_enabled; 261 JabberFeatureEnabled *is_enabled;
254 } JabberFeature; 262 } JabberFeature;
263
264 typedef struct _JabberIdentity
265 {
266 gchar *category;
267 gchar *type;
268 gchar *name;
269 gchar *lang;
270 } JabberIdentity;
255 271
256 typedef struct _JabberBytestreamsStreamhost { 272 typedef struct _JabberBytestreamsStreamhost {
257 char *jid; 273 char *jid;
258 char *host; 274 char *host;
259 int port; 275 int port;
260 char *zeroconf; 276 char *zeroconf;
261 } JabberBytestreamsStreamhost; 277 } JabberBytestreamsStreamhost;
262 278
263 /* what kind of additional features as returned from disco#info are supported? */ 279 /* what kind of additional features as returned from disco#info are supported? */
264 extern GList *jabber_features; 280 extern GList *jabber_features;
265 281 extern GList *jabber_identities;
282
283 void jabber_stream_features_parse(JabberStream *js, xmlnode *packet);
266 void jabber_process_packet(JabberStream *js, xmlnode **packet); 284 void jabber_process_packet(JabberStream *js, xmlnode **packet);
267 void jabber_send(JabberStream *js, xmlnode *data); 285 void jabber_send(JabberStream *js, xmlnode *data);
268 void jabber_send_raw(JabberStream *js, const char *data, int len); 286 void jabber_send_raw(JabberStream *js, const char *data, int len);
269 287
270 void jabber_stream_set_state(JabberStream *js, JabberStreamState state); 288 void jabber_stream_set_state(JabberStream *js, JabberStreamState state);
281 * @param reason where to store the disconnection reason, or @c NULL if you 299 * @param reason where to store the disconnection reason, or @c NULL if you
282 * don't care or you don't intend to close the connection. 300 * don't care or you don't intend to close the connection.
283 */ 301 */
284 char *jabber_parse_error(JabberStream *js, xmlnode *packet, PurpleConnectionError *reason); 302 char *jabber_parse_error(JabberStream *js, xmlnode *packet, PurpleConnectionError *reason);
285 303
286 void jabber_add_feature(const gchar *shortname, const gchar *namespace, JabberFeatureEnabled cb); /* cb may be NULL */ 304 void jabber_add_feature(const gchar *namespace, JabberFeatureEnabled cb); /* cb may be NULL */
287 void jabber_remove_feature(const gchar *shortname); 305 void jabber_remove_feature(const gchar *namespace);
306
307 /** Adds an identitiy to this jabber library instance. For list of valid values vistit the
308 * webiste of the XMPP Registrar ( http://www.xmpp.org/registrar/disco-categories.html#client ).
309 * @param category the category of the identity.
310 * @param type the type of the identity.
311 * @param language the language localization of the name. Can be NULL.
312 * @param name the name of the identity.
313 */
314 void jabber_add_identity(const gchar *category, const gchar *type, const gchar *lang, const gchar *name);
288 315
289 /** PRPL functions */ 316 /** PRPL functions */
290 const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b); 317 const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b);
291 const char* jabber_list_emblem(PurpleBuddy *b); 318 const char* jabber_list_emblem(PurpleBuddy *b);
292 char *jabber_status_text(PurpleBuddy *b); 319 char *jabber_status_text(PurpleBuddy *b);
308 PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name); 335 PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name);
309 gboolean jabber_offline_message(const PurpleBuddy *buddy); 336 gboolean jabber_offline_message(const PurpleBuddy *buddy);
310 int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len); 337 int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len);
311 GList *jabber_actions(PurplePlugin *plugin, gpointer context); 338 GList *jabber_actions(PurplePlugin *plugin, gpointer context);
312 void jabber_register_commands(void); 339 void jabber_register_commands(void);
340
313 void jabber_init_plugin(PurplePlugin *plugin); 341 void jabber_init_plugin(PurplePlugin *plugin);
342 void jabber_uninit_plugin(void);
314 343
315 #endif /* _PURPLE_JABBER_H_ */ 344 #endif /* _PURPLE_JABBER_H_ */

mercurial