comparison libpurple/protocols/jabber/jabber.h @ 26528:882748e27f9d

propagate from branch 'im.pidgin.pidgin' (head 58b2ba106e563fcd0984b9438aa427f1d61e25e9) to branch 'im.pidgin.cpw.darkrain42.xmpp.bosh' (head 66b3abfbbc6c37e976677819dd23987db9d3b083)
author Paul Aurich <paul@darkrain42.org>
date Sat, 04 Apr 2009 03:15:59 +0000
parents 34eb898478b4 fcee93c74230
children 20743d9bd62d
comparison
equal deleted inserted replaced
26515:c08719989149 26528:882748e27f9d
61 #include "dnsquery.h" 61 #include "dnsquery.h"
62 62
63 #include "jutil.h" 63 #include "jutil.h"
64 #include "xmlnode.h" 64 #include "xmlnode.h"
65 #include "buddy.h" 65 #include "buddy.h"
66 #include "bosh.h"
66 67
67 #ifdef HAVE_CYRUS_SASL 68 #ifdef HAVE_CYRUS_SASL
68 #include <sasl/sasl.h> 69 #include <sasl/sasl.h>
69 #endif 70 #endif
70 71
71 #define CAPS0115_NODE "http://pidgin.im/caps" 72 #define CAPS0115_NODE "http://pidgin.im/"
72 73
73 /* Index into attention_types list */ 74 /* Index into attention_types list */
74 #define JABBER_BUZZ 0 75 #define JABBER_BUZZ 0
75 76
76 typedef enum { 77 typedef enum {
207 PurpleAccountUnregistrationCb unregistration_cb; 208 PurpleAccountUnregistrationCb unregistration_cb;
208 void *unregistration_user_data; 209 void *unregistration_user_data;
209 210
210 gboolean vcard_fetched; 211 gboolean vcard_fetched;
211 212
213 /* Entity Capabilities hash */
214 char *caps_hash;
215
212 /* does the local server support PEP? */ 216 /* does the local server support PEP? */
213 gboolean pep; 217 gboolean pep;
214 218
215 /* Is Buzz enabled? */ 219 /* Is Buzz enabled? */
216 gboolean allowBuzz; 220 gboolean allowBuzz;
234 238
235 char *certificate_CN; 239 char *certificate_CN;
236 240
237 /* A purple timeout tag for the keepalive */ 241 /* A purple timeout tag for the keepalive */
238 int keepalive_timeout; 242 int keepalive_timeout;
239 243
240 PurpleSrvResponse *srv_rec; 244 PurpleSrvResponse *srv_rec;
241 guint srv_rec_idx; 245 guint srv_rec_idx;
242 guint max_srv_rec_idx; 246 guint max_srv_rec_idx;
247
248 /* BOSH stuff */
249 gboolean use_bosh;
250 PurpleBOSHConnection *bosh;
251
243 /** 252 /**
244 * This linked list contains PurpleUtilFetchUrlData structs 253 * This linked list contains PurpleUtilFetchUrlData structs
245 * for when we lookup buddy icons from a url 254 * for when we lookup buddy icons from a url
246 */ 255 */
247 GSList *url_datas; 256 GSList *url_datas;
254 int stun_port; 263 int stun_port;
255 PurpleDnsQueryData *stun_query; 264 PurpleDnsQueryData *stun_query;
256 /* later add stuff to handle TURN relays... */ 265 /* later add stuff to handle TURN relays... */
257 }; 266 };
258 267
259 typedef gboolean (JabberFeatureEnabled)(JabberStream *js, const gchar *shortname, const gchar *namespace); 268 typedef gboolean (JabberFeatureEnabled)(JabberStream *js, const gchar *namespace);
260 269
261 typedef struct _JabberFeature 270 typedef struct _JabberFeature
262 { 271 {
263 gchar *shortname;
264 gchar *namespace; 272 gchar *namespace;
265 JabberFeatureEnabled *is_enabled; 273 JabberFeatureEnabled *is_enabled;
266 } JabberFeature; 274 } JabberFeature;
275
276 typedef struct _JabberIdentity
277 {
278 gchar *category;
279 gchar *type;
280 gchar *name;
281 gchar *lang;
282 } JabberIdentity;
267 283
268 typedef struct _JabberBytestreamsStreamhost { 284 typedef struct _JabberBytestreamsStreamhost {
269 char *jid; 285 char *jid;
270 char *host; 286 char *host;
271 int port; 287 int port;
272 char *zeroconf; 288 char *zeroconf;
273 } JabberBytestreamsStreamhost; 289 } JabberBytestreamsStreamhost;
274 290
275 /* what kind of additional features as returned from disco#info are supported? */ 291 /* what kind of additional features as returned from disco#info are supported? */
276 extern GList *jabber_features; 292 extern GList *jabber_features;
277 293 extern GList *jabber_identities;
294
295 void jabber_stream_features_parse(JabberStream *js, xmlnode *packet);
278 void jabber_process_packet(JabberStream *js, xmlnode **packet); 296 void jabber_process_packet(JabberStream *js, xmlnode **packet);
279 void jabber_send(JabberStream *js, xmlnode *data); 297 void jabber_send(JabberStream *js, xmlnode *data);
280 void jabber_send_raw(JabberStream *js, const char *data, int len); 298 void jabber_send_raw(JabberStream *js, const char *data, int len);
281 299
282 void jabber_stream_set_state(JabberStream *js, JabberStreamState state); 300 void jabber_stream_set_state(JabberStream *js, JabberStreamState state);
293 * @param reason where to store the disconnection reason, or @c NULL if you 311 * @param reason where to store the disconnection reason, or @c NULL if you
294 * don't care or you don't intend to close the connection. 312 * don't care or you don't intend to close the connection.
295 */ 313 */
296 char *jabber_parse_error(JabberStream *js, xmlnode *packet, PurpleConnectionError *reason); 314 char *jabber_parse_error(JabberStream *js, xmlnode *packet, PurpleConnectionError *reason);
297 315
298 void jabber_add_feature(const gchar *shortname, const gchar *namespace, JabberFeatureEnabled cb); /* cb may be NULL */ 316 void jabber_add_feature(const gchar *namespace, JabberFeatureEnabled cb); /* cb may be NULL */
299 void jabber_remove_feature(const gchar *shortname); 317 void jabber_remove_feature(const gchar *namespace);
318
319 /** Adds an identitiy to this jabber library instance. For list of valid values vistit the
320 * webiste of the XMPP Registrar ( http://www.xmpp.org/registrar/disco-categories.html#client ).
321 * @param category the category of the identity.
322 * @param type the type of the identity.
323 * @param language the language localization of the name. Can be NULL.
324 * @param name the name of the identity.
325 */
326 void jabber_add_identity(const gchar *category, const gchar *type, const gchar *lang, const gchar *name);
327
328 /**
329 * Returns true if this connection is over a secure (SSL) stream. Use this
330 * instead of checking js->gsc because BOSH stores its PurpleSslConnection
331 * members in its own data structure.
332 */
333 gboolean jabber_stream_is_ssl(JabberStream *js);
300 334
301 /** PRPL functions */ 335 /** PRPL functions */
302 const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b); 336 const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b);
303 const char* jabber_list_emblem(PurpleBuddy *b); 337 const char* jabber_list_emblem(PurpleBuddy *b);
304 char *jabber_status_text(PurpleBuddy *b); 338 char *jabber_status_text(PurpleBuddy *b);
323 GList *jabber_actions(PurplePlugin *plugin, gpointer context); 357 GList *jabber_actions(PurplePlugin *plugin, gpointer context);
324 gboolean jabber_initiate_media(PurpleConnection *gc, const char *who, 358 gboolean jabber_initiate_media(PurpleConnection *gc, const char *who,
325 PurpleMediaSessionType type); 359 PurpleMediaSessionType type);
326 PurpleMediaCaps jabber_get_media_caps(PurpleConnection *gc, const char *who); 360 PurpleMediaCaps jabber_get_media_caps(PurpleConnection *gc, const char *who);
327 void jabber_register_commands(void); 361 void jabber_register_commands(void);
362
328 void jabber_init_plugin(PurplePlugin *plugin); 363 void jabber_init_plugin(PurplePlugin *plugin);
364 void jabber_uninit_plugin(void);
329 365
330 #endif /* _PURPLE_JABBER_H_ */ 366 #endif /* _PURPLE_JABBER_H_ */