| 1 /** |
|
| 2 * @file jabber.h |
|
| 3 * |
|
| 4 * gaim |
|
| 5 * |
|
| 6 * Copyright (C) 2003 Nathan Walp <faceprint@faceprint.com> |
|
| 7 * |
|
| 8 * This program is free software; you can redistribute it and/or modify |
|
| 9 * it under the terms of the GNU General Public License as published by |
|
| 10 * the Free Software Foundation; either version 2 of the License, or |
|
| 11 * (at your option) any later version. |
|
| 12 * |
|
| 13 * This program is distributed in the hope that it will be useful, |
|
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 * GNU General Public License for more details. |
|
| 17 * |
|
| 18 * You should have received a copy of the GNU General Public License |
|
| 19 * along with this program; if not, write to the Free Software |
|
| 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 21 */ |
|
| 22 #ifndef _GAIM_JABBER_H_ |
|
| 23 #define _GAIM_JABBER_H_ |
|
| 24 |
|
| 25 #include <glib.h> |
|
| 26 #include "connection.h" |
|
| 27 #include "roomlist.h" |
|
| 28 #include "sslconn.h" |
|
| 29 |
|
| 30 #include "jutil.h" |
|
| 31 #include "xmlnode.h" |
|
| 32 |
|
| 33 #ifdef HAVE_CYRUS_SASL |
|
| 34 #include <sasl/sasl.h> |
|
| 35 #endif |
|
| 36 |
|
| 37 typedef enum { |
|
| 38 JABBER_CAP_NONE = 0, |
|
| 39 JABBER_CAP_XHTML = 1 << 0, |
|
| 40 JABBER_CAP_COMPOSING = 1 << 1, |
|
| 41 JABBER_CAP_SI = 1 << 2, |
|
| 42 JABBER_CAP_SI_FILE_XFER = 1 << 3, |
|
| 43 JABBER_CAP_BYTESTREAMS = 1 << 4, |
|
| 44 JABBER_CAP_IBB = 1 << 5, |
|
| 45 JABBER_CAP_CHAT_STATES = 1 << 6, |
|
| 46 JABBER_CAP_IQ_SEARCH = 1 << 7, |
|
| 47 JABBER_CAP_IQ_REGISTER = 1 << 8, |
|
| 48 JABBER_CAP_RETRIEVED = 1 << 31 |
|
| 49 } JabberCapabilities; |
|
| 50 |
|
| 51 typedef enum { |
|
| 52 JABBER_STREAM_OFFLINE, |
|
| 53 JABBER_STREAM_CONNECTING, |
|
| 54 JABBER_STREAM_INITIALIZING, |
|
| 55 JABBER_STREAM_AUTHENTICATING, |
|
| 56 JABBER_STREAM_REINITIALIZING, |
|
| 57 JABBER_STREAM_CONNECTED |
|
| 58 } JabberStreamState; |
|
| 59 |
|
| 60 typedef struct _JabberStream |
|
| 61 { |
|
| 62 int fd; |
|
| 63 |
|
| 64 GMarkupParseContext *context; |
|
| 65 xmlnode *current; |
|
| 66 |
|
| 67 enum { |
|
| 68 JABBER_PROTO_0_9, |
|
| 69 JABBER_PROTO_1_0 |
|
| 70 } protocol_version; |
|
| 71 enum { |
|
| 72 JABBER_AUTH_UNKNOWN, |
|
| 73 JABBER_AUTH_DIGEST_MD5, |
|
| 74 JABBER_AUTH_PLAIN, |
|
| 75 JABBER_AUTH_IQ_AUTH, |
|
| 76 JABBER_AUTH_CYRUS |
|
| 77 } auth_type; |
|
| 78 char *stream_id; |
|
| 79 JabberStreamState state; |
|
| 80 |
|
| 81 /* SASL authentication */ |
|
| 82 char *expected_rspauth; |
|
| 83 |
|
| 84 GHashTable *buddies; |
|
| 85 gboolean roster_parsed; |
|
| 86 |
|
| 87 GHashTable *chats; |
|
| 88 GList *chat_servers; |
|
| 89 GaimRoomlist *roomlist; |
|
| 90 GList *user_directories; |
|
| 91 |
|
| 92 GHashTable *iq_callbacks; |
|
| 93 GHashTable *disco_callbacks; |
|
| 94 int next_id; |
|
| 95 |
|
| 96 |
|
| 97 GList *oob_file_transfers; |
|
| 98 GList *file_transfers; |
|
| 99 |
|
| 100 time_t idle; |
|
| 101 |
|
| 102 JabberID *user; |
|
| 103 GaimConnection *gc; |
|
| 104 GaimSslConnection *gsc; |
|
| 105 |
|
| 106 gboolean registration; |
|
| 107 |
|
| 108 char *avatar_hash; |
|
| 109 GSList *pending_avatar_requests; |
|
| 110 |
|
| 111 /* OK, this stays at the end of the struct, so plugins can depend |
|
| 112 * on the rest of the stuff being in the right place |
|
| 113 */ |
|
| 114 #ifdef HAVE_CYRUS_SASL |
|
| 115 sasl_conn_t *sasl; |
|
| 116 sasl_callback_t *sasl_cb; |
|
| 117 int sasl_state; |
|
| 118 int sasl_maxbuf; |
|
| 119 GString *sasl_mechs; |
|
| 120 #endif |
|
| 121 |
|
| 122 } JabberStream; |
|
| 123 |
|
| 124 void jabber_process_packet(JabberStream *js, xmlnode *packet); |
|
| 125 void jabber_send(JabberStream *js, xmlnode *data); |
|
| 126 void jabber_send_raw(JabberStream *js, const char *data, int len); |
|
| 127 |
|
| 128 void jabber_stream_set_state(JabberStream *js, JabberStreamState state); |
|
| 129 |
|
| 130 void jabber_register_parse(JabberStream *js, xmlnode *packet); |
|
| 131 void jabber_register_start(JabberStream *js); |
|
| 132 |
|
| 133 char *jabber_get_next_id(JabberStream *js); |
|
| 134 |
|
| 135 char *jabber_parse_error(JabberStream *js, xmlnode *packet); |
|
| 136 |
|
| 137 #endif /* _GAIM_JABBER_H_ */ |
|