Frameworks/libpurple.framework/Versions/0.5.6/Headers/jabber.h
branchadium-1.3
changeset 350 708bedafdc3a
parent 349 17ef128722b7
child 351 b01ab9b157f9
     1.1 --- a/Frameworks/libpurple.framework/Versions/0.5.6/Headers/jabber.h	Sun Jun 21 22:04:11 2009 -0400
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,315 +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_RETRIEVED      = 1 << 31
    1.51 -} JabberCapabilities;
    1.52 -
    1.53 -typedef struct _JabberStream JabberStream;
    1.54 -
    1.55 -#include <libxml/parser.h>
    1.56 -#include <glib.h>
    1.57 -#include "circbuffer.h"
    1.58 -#include "connection.h"
    1.59 -#include "dnssrv.h"
    1.60 -#include "roomlist.h"
    1.61 -#include "sslconn.h"
    1.62 -
    1.63 -#include "jutil.h"
    1.64 -#include "xmlnode.h"
    1.65 -#include "buddy.h"
    1.66 -
    1.67 -#ifdef HAVE_CYRUS_SASL
    1.68 -#include <sasl/sasl.h>
    1.69 -#endif
    1.70 -
    1.71 -#define CAPS0115_NODE "http://pidgin.im/caps"
    1.72 -
    1.73 -/* Index into attention_types list */
    1.74 -#define JABBER_BUZZ 0
    1.75 -
    1.76 -typedef enum {
    1.77 -	JABBER_STREAM_OFFLINE,
    1.78 -	JABBER_STREAM_CONNECTING,
    1.79 -	JABBER_STREAM_INITIALIZING,
    1.80 -	JABBER_STREAM_INITIALIZING_ENCRYPTION,
    1.81 -	JABBER_STREAM_AUTHENTICATING,
    1.82 -	JABBER_STREAM_REINITIALIZING,
    1.83 -	JABBER_STREAM_CONNECTED
    1.84 -} JabberStreamState;
    1.85 -
    1.86 -struct _JabberStream
    1.87 -{
    1.88 -	int fd;
    1.89 -
    1.90 -	PurpleSrvQueryData *srv_query_data;
    1.91 -
    1.92 -	xmlParserCtxt *context;
    1.93 -	xmlnode *current;
    1.94 -
    1.95 -	enum {
    1.96 -		JABBER_PROTO_0_9,
    1.97 -		JABBER_PROTO_1_0
    1.98 -	} protocol_version;
    1.99 -	enum {
   1.100 -		JABBER_AUTH_UNKNOWN,
   1.101 -		JABBER_AUTH_DIGEST_MD5,
   1.102 -		JABBER_AUTH_PLAIN,
   1.103 -		JABBER_AUTH_IQ_AUTH,
   1.104 -		JABBER_AUTH_CYRUS
   1.105 -	} auth_type;
   1.106 -	char *stream_id;
   1.107 -	JabberStreamState state;
   1.108 -
   1.109 -	/* SASL authentication */
   1.110 -	char *expected_rspauth;
   1.111 -
   1.112 -	GHashTable *buddies;
   1.113 -	gboolean roster_parsed;
   1.114 -
   1.115 -	/*
   1.116 -	 * This boolean was added to eliminate a heinous bug where we would
   1.117 -	 * get into a loop with the server and move a buddy back and forth
   1.118 -	 * from one group to another.
   1.119 -	 *
   1.120 -	 * The sequence goes something like this:
   1.121 -	 * 1. Our resource and another resource both approve an authorization
   1.122 -	 *    request at the exact same time.  We put the buddy in group A and
   1.123 -	 *    the other resource put the buddy in group B.
   1.124 -	 * 2. The server receives the roster add for group B and sends us a
   1.125 -	 *    roster push.
   1.126 -	 * 3. We receive this roster push and modify our local blist.  This
   1.127 -	 *    triggers us to send a roster add for group B.
   1.128 -	 * 4. The server recieves our earlier roster add for group A and sends
   1.129 -	 *    us a roster push.
   1.130 -	 * 5. We receive this roster push and modify our local blist.  This
   1.131 -	 *    triggers us to send a roster add for group A.
   1.132 -	 * 6. The server receives our earlier roster add for group B and sends
   1.133 -	 *    us a roster push.
   1.134 -	 * (repeat steps 3 through 6 ad infinitum)
   1.135 -	 *
   1.136 -	 * This boolean is used to short-circuit the sending of a roster add
   1.137 -	 * when we receive a roster push.
   1.138 -	 *
   1.139 -	 * See these bug reports:
   1.140 -	 * http://trac.adiumx.com/ticket/8834
   1.141 -	 * http://developer.pidgin.im/ticket/5484
   1.142 -	 * http://developer.pidgin.im/ticket/6188
   1.143 -	 */
   1.144 -	gboolean currently_parsing_roster_push;
   1.145 -
   1.146 -	GHashTable *chats;
   1.147 -	GList *chat_servers;
   1.148 -	PurpleRoomlist *roomlist;
   1.149 -	GList *user_directories;
   1.150 -
   1.151 -	GHashTable *iq_callbacks;
   1.152 -	GHashTable *disco_callbacks;
   1.153 -	int next_id;
   1.154 -
   1.155 -	GList *bs_proxies;
   1.156 -	GList *oob_file_transfers;
   1.157 -	GList *file_transfers;
   1.158 -
   1.159 -	time_t idle;
   1.160 -
   1.161 -	JabberID *user;
   1.162 -	PurpleConnection *gc;
   1.163 -	PurpleSslConnection *gsc;
   1.164 -
   1.165 -	gboolean registration;
   1.166 -
   1.167 -	char *avatar_hash;
   1.168 -	GSList *pending_avatar_requests;
   1.169 -
   1.170 -	GSList *pending_buddy_info_requests;
   1.171 -
   1.172 -	PurpleCircBuffer *write_buffer;
   1.173 -	guint writeh;
   1.174 -
   1.175 -	gboolean reinit;
   1.176 -
   1.177 -	JabberCapabilities server_caps;
   1.178 -	gboolean googletalk;
   1.179 -	char *server_name;
   1.180 -
   1.181 -	char *gmail_last_time;
   1.182 -	char *gmail_last_tid;
   1.183 -
   1.184 -	char *serverFQDN;
   1.185 -
   1.186 -	/* OK, this stays at the end of the struct, so plugins can depend
   1.187 -	 * on the rest of the stuff being in the right place
   1.188 -	 */
   1.189 -#ifdef HAVE_CYRUS_SASL
   1.190 -	sasl_conn_t *sasl;
   1.191 -	sasl_callback_t *sasl_cb;
   1.192 -#else /* keep the struct the same size */
   1.193 -	void *sasl;
   1.194 -	void *sasl_cb;
   1.195 -#endif
   1.196 -	/* did someone say something about the end of the struct? */
   1.197 -#ifdef HAVE_CYRUS_SASL
   1.198 -	const char *current_mech;
   1.199 -	int auth_fail_count;
   1.200 -#endif
   1.201 -
   1.202 -	int sasl_state;
   1.203 -	int sasl_maxbuf;
   1.204 -	GString *sasl_mechs;
   1.205 -
   1.206 -	gboolean unregistration;
   1.207 -	PurpleAccountUnregistrationCb unregistration_cb;
   1.208 -	void *unregistration_user_data;
   1.209 -	
   1.210 -	gboolean vcard_fetched;
   1.211 -
   1.212 -	/* does the local server support PEP? */
   1.213 -	gboolean pep;
   1.214 -
   1.215 -	/* Is Buzz enabled? */
   1.216 -	gboolean allowBuzz;
   1.217 -	
   1.218 -	/* A list of JabberAdHocCommands supported by the server */
   1.219 -	GList *commands;
   1.220 -	
   1.221 -	/* last presence update to check for differences */
   1.222 -	JabberBuddyState old_state;
   1.223 -	char *old_msg;
   1.224 -	int old_priority;
   1.225 -	char *old_avatarhash;
   1.226 -	
   1.227 -	/* same for user tune */
   1.228 -	char *old_artist;
   1.229 -	char *old_title;
   1.230 -	char *old_source;
   1.231 -	char *old_uri;
   1.232 -	int old_length;
   1.233 -	char *old_track;
   1.234 -	
   1.235 -	char *certificate_CN;
   1.236 -	
   1.237 -	/* A purple timeout tag for the keepalive */
   1.238 -	int keepalive_timeout;
   1.239 -
   1.240 -	PurpleSrvResponse *srv_rec;
   1.241 -	guint srv_rec_idx;
   1.242 -	guint max_srv_rec_idx;
   1.243 -	/**
   1.244 -	 * This linked list contains PurpleUtilFetchUrlData structs
   1.245 -	 * for when we lookup buddy icons from a url
   1.246 -	 */
   1.247 -	GSList *url_datas;
   1.248 -};
   1.249 -
   1.250 -typedef gboolean (JabberFeatureEnabled)(JabberStream *js, const gchar *shortname, const gchar *namespace);
   1.251 -
   1.252 -typedef struct _JabberFeature
   1.253 -{
   1.254 -	gchar *shortname;
   1.255 -	gchar *namespace;
   1.256 -	JabberFeatureEnabled *is_enabled;
   1.257 -} JabberFeature;
   1.258 -
   1.259 -typedef struct _JabberBytestreamsStreamhost {
   1.260 -	char *jid;
   1.261 -	char *host;
   1.262 -	int port;
   1.263 -	char *zeroconf;
   1.264 -} JabberBytestreamsStreamhost;
   1.265 -
   1.266 -/* what kind of additional features as returned from disco#info are supported? */
   1.267 -extern GList *jabber_features;
   1.268 -
   1.269 -void jabber_process_packet(JabberStream *js, xmlnode **packet);
   1.270 -void jabber_send(JabberStream *js, xmlnode *data);
   1.271 -void jabber_send_raw(JabberStream *js, const char *data, int len);
   1.272 -
   1.273 -void jabber_stream_set_state(JabberStream *js, JabberStreamState state);
   1.274 -
   1.275 -void jabber_register_parse(JabberStream *js, xmlnode *packet);
   1.276 -void jabber_register_start(JabberStream *js);
   1.277 -
   1.278 -char *jabber_get_next_id(JabberStream *js);
   1.279 -
   1.280 -/** Parse an error into a human-readable string and optionally a disconnect
   1.281 - *  reason.
   1.282 - *  @param js     the stream on which the error occurred.
   1.283 - *  @param packet the error packet
   1.284 - *  @param reason where to store the disconnection reason, or @c NULL if you
   1.285 - *                don't care or you don't intend to close the connection.
   1.286 - */
   1.287 -char *jabber_parse_error(JabberStream *js, xmlnode *packet, PurpleConnectionError *reason);
   1.288 -
   1.289 -void jabber_add_feature(const gchar *shortname, const gchar *namespace, JabberFeatureEnabled cb); /* cb may be NULL */
   1.290 -void jabber_remove_feature(const gchar *shortname);
   1.291 -
   1.292 -/** PRPL functions */
   1.293 -const char *jabber_list_icon(PurpleAccount *a, PurpleBuddy *b);
   1.294 -const char* jabber_list_emblem(PurpleBuddy *b);
   1.295 -char *jabber_status_text(PurpleBuddy *b);
   1.296 -void jabber_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full);
   1.297 -GList *jabber_status_types(PurpleAccount *account);
   1.298 -void jabber_login(PurpleAccount *account);
   1.299 -void jabber_close(PurpleConnection *gc);
   1.300 -void jabber_idle_set(PurpleConnection *gc, int idle);
   1.301 -void jabber_request_block_list(JabberStream *js);
   1.302 -void jabber_add_deny(PurpleConnection *gc, const char *who);
   1.303 -void jabber_rem_deny(PurpleConnection *gc, const char *who);
   1.304 -void jabber_keepalive(PurpleConnection *gc);
   1.305 -void jabber_register_gateway(JabberStream *js, const char *gateway);
   1.306 -void jabber_register_account(PurpleAccount *account);
   1.307 -void jabber_unregister_account(PurpleAccount *account, PurpleAccountUnregistrationCb cb, void *user_data);
   1.308 -gboolean jabber_send_attention(PurpleConnection *gc, const char *username, guint code);
   1.309 -GList *jabber_attention_types(PurpleAccount *account);
   1.310 -void jabber_convo_closed(PurpleConnection *gc, const char *who);
   1.311 -PurpleChat *jabber_find_blist_chat(PurpleAccount *account, const char *name);
   1.312 -gboolean jabber_offline_message(const PurpleBuddy *buddy);
   1.313 -int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len);
   1.314 -GList *jabber_actions(PurplePlugin *plugin, gpointer context);
   1.315 -void jabber_register_commands(void);
   1.316 -void jabber_init_plugin(PurplePlugin *plugin);
   1.317 -
   1.318 -#endif /* _PURPLE_JABBER_H_ */