14192
|
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 #ifdef HAVE_LIBXML
|
|
26 #include <libxml/parser.h>
|
|
27 #endif
|
|
28 #include <glib.h>
|
|
29 #include "circbuffer.h"
|
|
30 #include "connection.h"
|
14308
|
31 #include "dnssrv.h"
|
14192
|
32 #include "roomlist.h"
|
|
33 #include "sslconn.h"
|
|
34
|
|
35 #include "jutil.h"
|
|
36 #include "xmlnode.h"
|
|
37
|
|
38 #ifdef HAVE_CYRUS_SASL
|
|
39 #include <sasl/sasl.h>
|
|
40 #endif
|
|
41
|
|
42 #define CAPS0115_NODE "http://gaim.sf.net/caps"
|
|
43
|
|
44 typedef enum {
|
|
45 JABBER_CAP_NONE = 0,
|
|
46 JABBER_CAP_XHTML = 1 << 0,
|
|
47 JABBER_CAP_COMPOSING = 1 << 1,
|
|
48 JABBER_CAP_SI = 1 << 2,
|
|
49 JABBER_CAP_SI_FILE_XFER = 1 << 3,
|
|
50 JABBER_CAP_BYTESTREAMS = 1 << 4,
|
|
51 JABBER_CAP_IBB = 1 << 5,
|
|
52 JABBER_CAP_CHAT_STATES = 1 << 6,
|
|
53 JABBER_CAP_IQ_SEARCH = 1 << 7,
|
|
54 JABBER_CAP_IQ_REGISTER = 1 << 8,
|
|
55 JABBER_CAP_RETRIEVED = 1 << 31
|
|
56 } JabberCapabilities;
|
|
57
|
|
58 typedef enum {
|
|
59 JABBER_STREAM_OFFLINE,
|
|
60 JABBER_STREAM_CONNECTING,
|
|
61 JABBER_STREAM_INITIALIZING,
|
|
62 JABBER_STREAM_AUTHENTICATING,
|
|
63 JABBER_STREAM_REINITIALIZING,
|
|
64 JABBER_STREAM_CONNECTED
|
|
65 } JabberStreamState;
|
|
66
|
|
67 typedef struct _JabberStream
|
|
68 {
|
|
69 int fd;
|
|
70
|
14308
|
71 GaimSrvQueryData *srv_query_data;
|
14262
|
72 GaimProxyConnectData *connect_data;
|
14192
|
73
|
|
74 #ifdef HAVE_LIBXML
|
|
75 xmlParserCtxt *context;
|
|
76 #else
|
|
77 GMarkupParseContext *context;
|
|
78 #endif
|
|
79 xmlnode *current;
|
|
80
|
|
81 enum {
|
|
82 JABBER_PROTO_0_9,
|
|
83 JABBER_PROTO_1_0
|
|
84 } protocol_version;
|
|
85 enum {
|
|
86 JABBER_AUTH_UNKNOWN,
|
|
87 JABBER_AUTH_DIGEST_MD5,
|
|
88 JABBER_AUTH_PLAIN,
|
|
89 JABBER_AUTH_IQ_AUTH,
|
|
90 JABBER_AUTH_CYRUS
|
|
91 } auth_type;
|
|
92 char *stream_id;
|
|
93 JabberStreamState state;
|
|
94
|
|
95 /* SASL authentication */
|
|
96 char *expected_rspauth;
|
|
97
|
|
98 GHashTable *buddies;
|
|
99 gboolean roster_parsed;
|
|
100
|
|
101 GHashTable *chats;
|
|
102 GList *chat_servers;
|
|
103 GaimRoomlist *roomlist;
|
|
104 GList *user_directories;
|
|
105
|
|
106 GHashTable *iq_callbacks;
|
|
107 GHashTable *disco_callbacks;
|
|
108 int next_id;
|
|
109
|
|
110
|
|
111 GList *oob_file_transfers;
|
|
112 GList *file_transfers;
|
|
113
|
|
114 JabberID *user;
|
|
115 GaimConnection *gc;
|
|
116 GaimSslConnection *gsc;
|
|
117
|
|
118 gboolean registration;
|
|
119
|
|
120 char *avatar_hash;
|
|
121 GSList *pending_avatar_requests;
|
|
122
|
|
123 GaimCircBuffer *write_buffer;
|
|
124 guint writeh;
|
|
125
|
|
126 gboolean reinit;
|
|
127
|
|
128 /* OK, this stays at the end of the struct, so plugins can depend
|
|
129 * on the rest of the stuff being in the right place
|
|
130 */
|
|
131 #ifdef HAVE_CYRUS_SASL
|
|
132 sasl_conn_t *sasl;
|
|
133 sasl_callback_t *sasl_cb;
|
|
134 int sasl_state;
|
|
135 int sasl_maxbuf;
|
|
136 GString *sasl_mechs;
|
|
137 #endif
|
|
138
|
|
139 } JabberStream;
|
|
140
|
|
141 void jabber_process_packet(JabberStream *js, xmlnode *packet);
|
|
142 void jabber_send(JabberStream *js, xmlnode *data);
|
|
143 void jabber_send_raw(JabberStream *js, const char *data, int len);
|
|
144
|
|
145 void jabber_stream_set_state(JabberStream *js, JabberStreamState state);
|
|
146
|
|
147 void jabber_register_parse(JabberStream *js, xmlnode *packet);
|
|
148 void jabber_register_start(JabberStream *js);
|
|
149
|
|
150 char *jabber_get_next_id(JabberStream *js);
|
|
151
|
|
152 char *jabber_parse_error(JabberStream *js, xmlnode *packet);
|
|
153
|
|
154 #endif /* _GAIM_JABBER_H_ */
|