1.1 --- a/Frameworks/libpurple.framework/Versions/0.6.0/Headers/jabber.h Fri Aug 21 13:24:36 2009 -0700
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,385 +0,0 @@
1.4 -/**
1.5 - * @file jabber.h
1.6 - *
1.7 - * purple
1.8 - *
1.9 - * Copyright (C) 2003 Nathan Walp <faceprint@faceprint.com>
1.10 - *
1.11 - * This program is free software; you can redistribute it and/or modify
1.12 - * it under the terms of the GNU General Public License as published by
1.13 - * the Free Software Foundation; either version 2 of the License, or
1.14 - * (at your option) any later version.
1.15 - *
1.16 - * This program is distributed in the hope that it will be useful,
1.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.19 - * GNU General Public License for more details.
1.20 - *
1.21 - * You should have received a copy of the GNU General Public License
1.22 - * along with this program; if not, write to the Free Software
1.23 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
1.24 - */
1.25 -#ifndef PURPLE_JABBER_H_
1.26 -#define PURPLE_JABBER_H_
1.27 -
1.28 -typedef enum {
1.29 - JABBER_CAP_NONE = 0,
1.30 -/* JABBER_CAP_XHTML = 1 << 0, */
1.31 -/* JABBER_CAP_COMPOSING = 1 << 1, */
1.32 - JABBER_CAP_SI = 1 << 2,
1.33 - JABBER_CAP_SI_FILE_XFER = 1 << 3,
1.34 - JABBER_CAP_BYTESTREAMS = 1 << 4,
1.35 - JABBER_CAP_IBB = 1 << 5,
1.36 - JABBER_CAP_CHAT_STATES = 1 << 6,
1.37 - JABBER_CAP_IQ_SEARCH = 1 << 7,
1.38 - JABBER_CAP_IQ_REGISTER = 1 << 8,
1.39 -
1.40 - /* Google Talk extensions:
1.41 - * http://code.google.com/apis/talk/jep_extensions/extensions.html
1.42 - */
1.43 - JABBER_CAP_GMAIL_NOTIFY = 1 << 9,
1.44 - JABBER_CAP_GOOGLE_ROSTER = 1 << 10,
1.45 -
1.46 - JABBER_CAP_PING = 1 << 11,
1.47 - JABBER_CAP_ADHOC = 1 << 12,
1.48 - JABBER_CAP_BLOCKING = 1 << 13,
1.49 -
1.50 - JABBER_CAP_ITEMS = 1 << 14,
1.51 -
1.52 - JABBER_CAP_RETRIEVED = 1 << 31
1.53 -} JabberCapabilities;
1.54 -
1.55 -typedef struct _JabberStream JabberStream;
1.56 -
1.57 -#include <libxml/parser.h>
1.58 -#include <glib.h>
1.59 -#include "circbuffer.h"
1.60 -#include "connection.h"
1.61 -#include "dnsquery.h"
1.62 -#include "dnssrv.h"
1.63 -#include "media.h"
1.64 -#include "mediamanager.h"
1.65 -#include "roomlist.h"
1.66 -#include "sslconn.h"
1.67 -
1.68 -#include "iq.h"
1.69 -#include "jutil.h"
1.70 -#include "xmlnode.h"
1.71 -#include "buddy.h"
1.72 -#include "bosh.h"
1.73 -
1.74 -#ifdef HAVE_CYRUS_SASL
1.75 -#include <sasl/sasl.h>
1.76 -#endif
1.77 -
1.78 -#define CAPS0115_NODE "http://pidgin.im/"
1.79 -
1.80 -/* Index into attention_types list */
1.81 -#define JABBER_BUZZ 0
1.82 -
1.83 -extern PurplePlugin *jabber_plugin;
1.84 -
1.85 -typedef enum {
1.86 - JABBER_STREAM_OFFLINE,
1.87 - JABBER_STREAM_CONNECTING,
1.88 - JABBER_STREAM_INITIALIZING,
1.89 - JABBER_STREAM_INITIALIZING_ENCRYPTION,
1.90 - JABBER_STREAM_AUTHENTICATING,
1.91 - JABBER_STREAM_REINITIALIZING,
1.92 - JABBER_STREAM_CONNECTED
1.93 -} JabberStreamState;
1.94 -
1.95 -struct _JabberStream
1.96 -{
1.97 - int fd;
1.98 -
1.99 - PurpleSrvQueryData *srv_query_data;
1.100 -
1.101 - xmlParserCtxt *context;
1.102 - xmlnode *current;
1.103 -
1.104 - enum {
1.105 - JABBER_PROTO_0_9,
1.106 - JABBER_PROTO_1_0
1.107 - } protocol_version;
1.108 - enum {
1.109 - JABBER_AUTH_UNKNOWN,
1.110 - JABBER_AUTH_DIGEST_MD5,
1.111 - JABBER_AUTH_PLAIN,
1.112 - JABBER_AUTH_IQ_AUTH,
1.113 - JABBER_AUTH_CYRUS
1.114 - } auth_type;
1.115 - char *stream_id;
1.116 - JabberStreamState state;
1.117 -
1.118 - /* SASL authentication */
1.119 - char *expected_rspauth;
1.120 -
1.121 - GHashTable *buddies;
1.122 -
1.123 - /*
1.124 - * This boolean was added to eliminate a heinous bug where we would
1.125 - * get into a loop with the server and move a buddy back and forth
1.126 - * from one group to another.
1.127 - *
1.128 - * The sequence goes something like this:
1.129 - * 1. Our resource and another resource both approve an authorization
1.130 - * request at the exact same time. We put the buddy in group A and
1.131 - * the other resource put the buddy in group B.
1.132 - * 2. The server receives the roster add for group B and sends us a
1.133 - * roster push.
1.134 - * 3. We receive this roster push and modify our local blist. This
1.135 - * triggers us to send a roster add for group B.
1.136 - * 4. The server recieves our earlier roster add for group A and sends
1.137 - * us a roster push.
1.138 - * 5. We receive this roster push and modify our local blist. This
1.139 - * triggers us to send a roster add for group A.
1.140 - * 6. The server receives our earlier roster add for group B and sends
1.141 - * us a roster push.
1.142 - * (repeat steps 3 through 6 ad infinitum)
1.143 - *
1.144 - * This boolean is used to short-circuit the sending of a roster add
1.145 - * when we receive a roster push.
1.146 - *
1.147 - * See these bug reports:
1.148 - * http://trac.adiumx.com/ticket/8834
1.149 - * http://developer.pidgin.im/ticket/5484
1.150 - * http://developer.pidgin.im/ticket/6188
1.151 - */
1.152 - gboolean currently_parsing_roster_push;
1.153 -
1.154 - GHashTable *chats;
1.155 - GList *chat_servers;
1.156 - PurpleRoomlist *roomlist;
1.157 - GList *user_directories;
1.158 -
1.159 - GHashTable *iq_callbacks;
1.160 - int next_id;
1.161 -
1.162 - GList *bs_proxies;
1.163 - GList *oob_file_transfers;
1.164 - GList *file_transfers;
1.165 -
1.166 - time_t idle;
1.167 - time_t old_idle;
1.168 -
1.169 - JabberID *user;
1.170 - JabberBuddy *user_jb;
1.171 -
1.172 - PurpleConnection *gc;
1.173 - PurpleSslConnection *gsc;
1.174 -
1.175 - gboolean registration;
1.176 -
1.177 - char *initial_avatar_hash;
1.178 - char *avatar_hash;
1.179 - GSList *pending_avatar_requests;
1.180 -
1.181 - GSList *pending_buddy_info_requests;
1.182 -
1.183 - PurpleCircBuffer *write_buffer;
1.184 - guint writeh;
1.185 -
1.186 - gboolean reinit;
1.187 -
1.188 - JabberCapabilities server_caps;
1.189 - gboolean googletalk;
1.190 - char *server_name;
1.191 -
1.192 - char *gmail_last_time;
1.193 - char *gmail_last_tid;
1.194 -
1.195 - char *serverFQDN;
1.196 -
1.197 - /* OK, this stays at the end of the struct, so plugins can depend
1.198 - * on the rest of the stuff being in the right place
1.199 - */
1.200 -#ifdef HAVE_CYRUS_SASL
1.201 - sasl_conn_t *sasl;
1.202 - sasl_callback_t *sasl_cb;
1.203 -#else /* keep the struct the same size */
1.204 - void *sasl;
1.205 - void *sasl_cb;
1.206 -#endif
1.207 - /* did someone say something about the end of the struct? */
1.208 -#ifdef HAVE_CYRUS_SASL
1.209 - const char *current_mech;
1.210 - int auth_fail_count;
1.211 -#endif
1.212 -
1.213 - int sasl_state;
1.214 - int sasl_maxbuf;
1.215 - GString *sasl_mechs;
1.216 -
1.217 - gboolean unregistration;
1.218 - PurpleAccountUnregistrationCb unregistration_cb;
1.219 - void *unregistration_user_data;
1.220 -
1.221 - gboolean vcard_fetched;
1.222 - /* Timer at login to push updated avatar */
1.223 - guint vcard_timer;
1.224 -
1.225 - /* Entity Capabilities hash */
1.226 - char *caps_hash;
1.227 -
1.228 - /* does the local server support PEP? */
1.229 - gboolean pep;
1.230 -
1.231 - /* Is Buzz enabled? */
1.232 - gboolean allowBuzz;
1.233 -
1.234 - /* A list of JabberAdHocCommands supported by the server */
1.235 - GList *commands;
1.236 -
1.237 - /* last presence update to check for differences */
1.238 - JabberBuddyState old_state;
1.239 - char *old_msg;
1.240 - int old_priority;
1.241 - char *old_avatarhash;
1.242 -
1.243 - /* same for user tune */
1.244 - char *old_artist;
1.245 - char *old_title;
1.246 - char *old_source;
1.247 - char *old_uri;
1.248 - int old_length;
1.249 - char *old_track;
1.250 -
1.251 - char *certificate_CN;
1.252 -
1.253 - /* A purple timeout tag for the keepalive */
1.254 - guint keepalive_timeout;
1.255 -
1.256 - PurpleSrvResponse *srv_rec;
1.257 - guint srv_rec_idx;
1.258 - guint max_srv_rec_idx;
1.259 -
1.260 - /* BOSH stuff */
1.261 - PurpleBOSHConnection *bosh;
1.262 -
1.263 - /**
1.264 - * This linked list contains PurpleUtilFetchUrlData structs
1.265 - * for when we lookup buddy icons from a url
1.266 - */
1.267 - GSList *url_datas;
1.268 -
1.269 - /* keep a hash table of JingleSessions */
1.270 - GHashTable *sessions;
1.271 -
1.272 - /* maybe this should only be present when USE_VV? */
1.273 - gchar *stun_ip;
1.274 - int stun_port;
1.275 - PurpleDnsQueryData *stun_query;
1.276 - /* later add stuff to handle TURN relays... */
1.277 -};
1.278 -
1.279 -typedef gboolean (JabberFeatureEnabled)(JabberStream *js, const gchar *namespace);
1.280 -
1.281 -typedef struct _JabberFeature
1.282 -{
1.283 - gchar *namespace;
1.284 - JabberFeatureEnabled *is_enabled;
1.285 -} JabberFeature;
1.286 -
1.287 -typedef struct _JabberIdentity
1.288 -{
1.289 - gchar *category;
1.290 - gchar *type;
1.291 - gchar *name;
1.292 - gchar *lang;
1.293 -} JabberIdentity;
1.294 -
1.295 -typedef struct _JabberBytestreamsStreamhost {
1.296 - char *jid;
1.297 - char *host;
1.298 - int port;
1.299 - char *zeroconf;
1.300 -} JabberBytestreamsStreamhost;
1.301 -
1.302 -/* what kind of additional features as returned from disco#info are supported? */
1.303 -extern GList *jabber_features;
1.304 -extern GList *jabber_identities;
1.305 -
1.306 -void jabber_stream_features_parse(JabberStream *js, xmlnode *packet);
1.307 -void jabber_process_packet(JabberStream *js, xmlnode **packet);
1.308 -void jabber_send(JabberStream *js, xmlnode *data);
1.309 -void jabber_send_raw(JabberStream *js, const char *data, int len);
1.310 -void jabber_send_signal_cb(PurpleConnection *pc, xmlnode **packet,
1.311 - gpointer unused);
1.312 -
1.313 -void jabber_stream_set_state(JabberStream *js, JabberStreamState state);
1.314 -
1.315 -void jabber_register_parse(JabberStream *js, const char *from,
1.316 - JabberIqType type, const char *id, xmlnode *query);
1.317 -void jabber_register_start(JabberStream *js);
1.318 -
1.319 -char *jabber_get_next_id(JabberStream *js);
1.320 -
1.321 -/** Parse an error into a human-readable string and optionally a disconnect
1.322 - * reason.
1.323 - * @param js the stream on which the error occurred.
1.324 - * @param packet the error packet
1.325 - * @param reason where to store the disconnection reason, or @c NULL if you
1.326 - * don't care or you don't intend to close the connection.
1.327 - */
1.328 -char *jabber_parse_error(JabberStream *js, xmlnode *packet, PurpleConnectionError *reason);
1.329 -
1.330 -void jabber_add_feature(const gchar *namespace, JabberFeatureEnabled cb); /* cb may be NULL */
1.331 -void jabber_remove_feature(const gchar *namespace);
1.332 -
1.333 -/** Adds an identity to this jabber library instance. For list of valid values visit the
1.334 - * website of the XMPP Registrar ( http://www.xmpp.org/registrar/disco-categories.html#client ).
1.335 - * @param category the category of the identity.
1.336 - * @param type the type of the identity.
1.337 - * @param language the language localization of the name. Can be NULL.
1.338 - * @param name the name of the identity.
1.339 - */
1.340 -void jabber_add_identity(const gchar *category, const gchar *type, const gchar *lang, const gchar *name);
1.341 -
1.342 -/**
1.343 - * Returns true if this connection is over a secure (SSL) stream. Use this
1.344 - * instead of checking js->gsc because BOSH stores its PurpleSslConnection
1.345 - * members in its own data structure.
1.346 - */
1.347 -gboolean jabber_stream_is_ssl(JabberStream *js);
1.348 -
1.349 -/** PRPL functions */
1.350 -const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b);
1.351 -const char* jabber_list_emblem(PurpleBuddy *b);
1.352 -char *jabber_status_text(PurpleBuddy *b);
1.353 -void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full);
1.354 -GList *jabber_status_types(PurpleAccount *account);
1.355 -void jabber_login(PurpleAccount *account);
1.356 -void jabber_close(PurpleConnection *gc);
1.357 -void jabber_idle_set(PurpleConnection *gc, int idle);
1.358 -void jabber_blocklist_parse_push(JabberStream *js, const char *from,
1.359 - JabberIqType type, const char *id,
1.360 - xmlnode *child);
1.361 -void jabber_request_block_list(JabberStream *js);
1.362 -void jabber_add_deny(PurpleConnection *gc, const char *who);
1.363 -void jabber_rem_deny(PurpleConnection *gc, const char *who);
1.364 -void jabber_keepalive(PurpleConnection *gc);
1.365 -void jabber_register_gateway(JabberStream *js, const char *gateway);
1.366 -void jabber_register_account(PurpleAccount *account);
1.367 -void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data);
1.368 -gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code);
1.369 -GList *jabber_attention_types(PurpleAccount *account);
1.370 -void jabber_convo_closed(PurpleConnection *gc, const char *who);
1.371 -PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name);
1.372 -gboolean jabber_offline_message(const PurpleBuddy *buddy);
1.373 -int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len);
1.374 -GList *jabber_actions(PurplePlugin *plugin, gpointer context);
1.375 -
1.376 -gboolean jabber_audio_enabled(JabberStream *js, const char *unused);
1.377 -gboolean jabber_video_enabled(JabberStream *js, const char *unused);
1.378 -gboolean jabber_initiate_media(PurpleAccount *account, const char *who,
1.379 - PurpleMediaSessionType type);
1.380 -PurpleMediaCaps jabber_get_media_caps(PurpleAccount *account, const char *who);
1.381 -
1.382 -void jabber_register_commands(void);
1.383 -void jabber_unregister_commands(void);
1.384 -
1.385 -void jabber_init_plugin(PurplePlugin *plugin);
1.386 -void jabber_uninit_plugin(void);
1.387 -
1.388 -#endif /* PURPLE_JABBER_H_ */