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