Wed, 12 Nov 2008 05:14:03 +0000
merge of '77693555855fe9cd3215414f79964dba346cc5fa'
and '19a87e98e5857ad0289f2c760d460f7f1dbbb42d'
| 7014 | 1 | /** |
| 2 | * @file jabber.h | |
| 3 | * | |
| 4 | * gaim | |
| 5 | * | |
| 6 | * Copyright (C) 2003 Nathan Walp <faceprint@faceprint.com> | |
| 2086 | 7 | * |
| 7014 | 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. | |
| 2086 | 12 | * |
| 7014 | 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. | |
| 2086 | 17 | * |
| 7014 | 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 | |
| 2086 | 21 | */ |
| 7014 | 22 | #ifndef _GAIM_JABBER_H_ |
| 23 | #define _GAIM_JABBER_H_ | |
| 2086 | 24 | |
| 13808 | 25 | #include <libxml/parser.h> |
| 7014 | 26 | #include <glib.h> |
|
14013
86dac5633bd9
[gaim-migrate @ 16496]
Mark Doliner <markdoliner@pidgin.im>
parents:
13808
diff
changeset
|
27 | #include "circbuffer.h" |
| 7014 | 28 | #include "connection.h" |
|
14370
12ef3d4096ee
[gaim-migrate @ 16998]
Mark Doliner <markdoliner@pidgin.im>
parents:
14324
diff
changeset
|
29 | #include "dnssrv.h" |
| 8113 | 30 | #include "roomlist.h" |
| 7014 | 31 | #include "sslconn.h" |
| 2086 | 32 | |
| 7014 | 33 | #include "jutil.h" |
| 34 | #include "xmlnode.h" | |
| 2086 | 35 | |
| 12508 | 36 | #ifdef HAVE_CYRUS_SASL |
| 37 | #include <sasl/sasl.h> | |
| 38 | #endif | |
| 39 | ||
| 13385 | 40 | #define CAPS0115_NODE "http://gaim.sf.net/caps" |
| 41 | ||
| 7014 | 42 | typedef enum { |
| 8312 | 43 | JABBER_CAP_NONE = 0, |
| 44 | JABBER_CAP_XHTML = 1 << 0, | |
| 45 | JABBER_CAP_COMPOSING = 1 << 1, | |
| 46 | JABBER_CAP_SI = 1 << 2, | |
| 47 | JABBER_CAP_SI_FILE_XFER = 1 << 3, | |
| 48 | JABBER_CAP_BYTESTREAMS = 1 << 4, | |
| 49 | JABBER_CAP_IBB = 1 << 5, | |
| 11393 | 50 | JABBER_CAP_CHAT_STATES = 1 << 6, |
| 11675 | 51 | JABBER_CAP_IQ_SEARCH = 1 << 7, |
| 52 | JABBER_CAP_IQ_REGISTER = 1 << 8, | |
| 15225 | 53 | |
| 54 | /* Google Talk extensions: | |
| 55 | * http://code.google.com/apis/talk/jep_extensions/extensions.html | |
| 56 | */ | |
| 57 | JABBER_CAP_GMAIL_NOTIFY = 1 << 9, | |
| 15265 | 58 | JABBER_CAP_GOOGLE_ROSTER = 1 << 10, |
| 15225 | 59 | |
| 8312 | 60 | JABBER_CAP_RETRIEVED = 1 << 31 |
| 61 | } JabberCapabilities; | |
| 62 | ||
| 63 | typedef enum { | |
| 7014 | 64 | JABBER_STREAM_OFFLINE, |
| 65 | JABBER_STREAM_CONNECTING, | |
| 66 | JABBER_STREAM_INITIALIZING, | |
| 67 | JABBER_STREAM_AUTHENTICATING, | |
| 68 | JABBER_STREAM_REINITIALIZING, | |
| 69 | JABBER_STREAM_CONNECTED | |
| 70 | } JabberStreamState; | |
| 2086 | 71 | |
| 7014 | 72 | typedef struct _JabberStream |
| 2086 | 73 | { |
| 7014 | 74 | int fd; |
| 2086 | 75 | |
|
14370
12ef3d4096ee
[gaim-migrate @ 16998]
Mark Doliner <markdoliner@pidgin.im>
parents:
14324
diff
changeset
|
76 | GaimSrvQueryData *srv_query_data; |
|
14175
2bc5a80c5071
[gaim-migrate @ 16747]
Mark Doliner <markdoliner@pidgin.im>
parents:
14062
diff
changeset
|
77 | |
| 13808 | 78 | xmlParserCtxt *context; |
| 7014 | 79 | xmlnode *current; |
| 2086 | 80 | |
| 7014 | 81 | enum { |
| 82 | JABBER_PROTO_0_9, | |
| 83 | JABBER_PROTO_1_0 | |
| 84 | } protocol_version; | |
| 7291 | 85 | enum { |
| 8296 | 86 | JABBER_AUTH_UNKNOWN, |
| 7291 | 87 | JABBER_AUTH_DIGEST_MD5, |
| 8296 | 88 | JABBER_AUTH_PLAIN, |
| 12508 | 89 | JABBER_AUTH_IQ_AUTH, |
| 90 | JABBER_AUTH_CYRUS | |
| 7291 | 91 | } auth_type; |
| 7014 | 92 | char *stream_id; |
| 93 | JabberStreamState state; | |
| 2086 | 94 | |
| 7014 | 95 | /* SASL authentication */ |
| 96 | char *expected_rspauth; | |
| 2086 | 97 | |
| 7014 | 98 | GHashTable *buddies; |
| 99 | gboolean roster_parsed; | |
| 2086 | 100 | |
| 7014 | 101 | GHashTable *chats; |
| 8043 | 102 | GList *chat_servers; |
| 8113 | 103 | GaimRoomlist *roomlist; |
| 11675 | 104 | GList *user_directories; |
| 2086 | 105 | |
| 8312 | 106 | GHashTable *iq_callbacks; |
| 107 | GHashTable *disco_callbacks; | |
| 7014 | 108 | int next_id; |
| 2086 | 109 | |
| 8312 | 110 | |
| 7395 | 111 | GList *oob_file_transfers; |
| 7170 | 112 | GList *file_transfers; |
| 113 | ||
|
14453
1cc75906700c
[gaim-migrate @ 17098]
Mark Doliner <markdoliner@pidgin.im>
parents:
14375
diff
changeset
|
114 | time_t idle; |
|
1cc75906700c
[gaim-migrate @ 17098]
Mark Doliner <markdoliner@pidgin.im>
parents:
14375
diff
changeset
|
115 | |
| 7014 | 116 | JabberID *user; |
| 117 | GaimConnection *gc; | |
| 118 | GaimSslConnection *gsc; | |
| 7072 | 119 | |
| 120 | gboolean registration; | |
| 10189 | 121 | |
| 122 | char *avatar_hash; | |
| 10941 | 123 | GSList *pending_avatar_requests; |
| 12508 | 124 | |
|
15363
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15265
diff
changeset
|
125 | GSList *pending_buddy_info_requests; |
|
f6b9d1e3d0cb
[gaim-migrate @ 18092]
Evan Schoenberg <evands@pidgin.im>
parents:
15265
diff
changeset
|
126 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12508
diff
changeset
|
127 | GaimCircBuffer *write_buffer; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12508
diff
changeset
|
128 | guint writeh; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
12508
diff
changeset
|
129 | |
| 14062 | 130 | gboolean reinit; |
| 131 | ||
| 15225 | 132 | JabberCapabilities server_caps; |
| 15197 | 133 | gboolean googletalk; |
| 134 | char *server_name; | |
| 15225 | 135 | |
| 136 | char *gmail_last_time; | |
| 137 | char *gmail_last_tid; | |
| 15197 | 138 | |
| 12508 | 139 | /* OK, this stays at the end of the struct, so plugins can depend |
| 140 | * on the rest of the stuff being in the right place | |
| 141 | */ | |
| 142 | #ifdef HAVE_CYRUS_SASL | |
| 143 | sasl_conn_t *sasl; | |
| 144 | sasl_callback_t *sasl_cb; | |
| 145 | int sasl_state; | |
| 146 | int sasl_maxbuf; | |
| 147 | GString *sasl_mechs; | |
| 148 | #endif | |
| 149 | ||
| 7014 | 150 | } JabberStream; |
| 2086 | 151 | |
| 7014 | 152 | void jabber_process_packet(JabberStream *js, xmlnode *packet); |
| 153 | void jabber_send(JabberStream *js, xmlnode *data); | |
| 7642 | 154 | void jabber_send_raw(JabberStream *js, const char *data, int len); |
| 2086 | 155 | |
| 7014 | 156 | void jabber_stream_set_state(JabberStream *js, JabberStreamState state); |
| 2086 | 157 | |
| 7077 | 158 | void jabber_register_parse(JabberStream *js, xmlnode *packet); |
| 8016 | 159 | void jabber_register_start(JabberStream *js); |
| 7077 | 160 | |
| 7014 | 161 | char *jabber_get_next_id(JabberStream *js); |
| 2086 | 162 | |
| 8401 | 163 | char *jabber_parse_error(JabberStream *js, xmlnode *packet); |
| 164 | ||
| 7014 | 165 | #endif /* _GAIM_JABBER_H_ */ |