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
|
7014
|
25 #include <glib.h>
|
|
26 #include "connection.h"
|
8113
|
27 #include "roomlist.h"
|
7014
|
28 #include "sslconn.h"
|
2086
|
29
|
7014
|
30 #include "jutil.h"
|
|
31 #include "xmlnode.h"
|
2086
|
32
|
7014
|
33 typedef enum {
|
8312
|
34 JABBER_CAP_NONE = 0,
|
|
35 JABBER_CAP_XHTML = 1 << 0,
|
|
36 JABBER_CAP_COMPOSING = 1 << 1,
|
|
37 JABBER_CAP_SI = 1 << 2,
|
|
38 JABBER_CAP_SI_FILE_XFER = 1 << 3,
|
|
39 JABBER_CAP_BYTESTREAMS = 1 << 4,
|
|
40 JABBER_CAP_IBB = 1 << 5,
|
11393
|
41 JABBER_CAP_CHAT_STATES = 1 << 6,
|
11675
|
42 JABBER_CAP_IQ_SEARCH = 1 << 7,
|
|
43 JABBER_CAP_IQ_REGISTER = 1 << 8,
|
8312
|
44 JABBER_CAP_RETRIEVED = 1 << 31
|
|
45 } JabberCapabilities;
|
|
46
|
|
47 typedef enum {
|
7014
|
48 JABBER_STREAM_OFFLINE,
|
|
49 JABBER_STREAM_CONNECTING,
|
|
50 JABBER_STREAM_INITIALIZING,
|
|
51 JABBER_STREAM_AUTHENTICATING,
|
|
52 JABBER_STREAM_REINITIALIZING,
|
|
53 JABBER_STREAM_CONNECTED
|
|
54 } JabberStreamState;
|
2086
|
55
|
7014
|
56 typedef struct _JabberStream
|
2086
|
57 {
|
7014
|
58 int fd;
|
2086
|
59
|
7014
|
60 GMarkupParseContext *context;
|
|
61 xmlnode *current;
|
2086
|
62
|
7014
|
63 enum {
|
|
64 JABBER_PROTO_0_9,
|
|
65 JABBER_PROTO_1_0
|
|
66 } protocol_version;
|
7291
|
67 enum {
|
8296
|
68 JABBER_AUTH_UNKNOWN,
|
7291
|
69 JABBER_AUTH_DIGEST_MD5,
|
8296
|
70 JABBER_AUTH_PLAIN,
|
|
71 JABBER_AUTH_IQ_AUTH
|
7291
|
72 } auth_type;
|
7014
|
73 char *stream_id;
|
|
74 JabberStreamState state;
|
2086
|
75
|
7014
|
76 /* SASL authentication */
|
|
77 char *expected_rspauth;
|
2086
|
78
|
7014
|
79 GHashTable *buddies;
|
|
80 gboolean roster_parsed;
|
2086
|
81
|
7014
|
82 GHashTable *chats;
|
8043
|
83 GList *chat_servers;
|
8113
|
84 GaimRoomlist *roomlist;
|
11675
|
85 GList *user_directories;
|
2086
|
86
|
8312
|
87 GHashTable *iq_callbacks;
|
|
88 GHashTable *disco_callbacks;
|
7014
|
89 int next_id;
|
2086
|
90
|
8312
|
91
|
7395
|
92 GList *oob_file_transfers;
|
7170
|
93 GList *file_transfers;
|
|
94
|
7014
|
95 time_t idle;
|
2086
|
96
|
7014
|
97 JabberID *user;
|
|
98 GaimConnection *gc;
|
|
99 GaimSslConnection *gsc;
|
7072
|
100
|
|
101 gboolean registration;
|
10189
|
102
|
|
103 char *avatar_hash;
|
10941
|
104 GSList *pending_avatar_requests;
|
7014
|
105 } JabberStream;
|
2086
|
106
|
7014
|
107 void jabber_process_packet(JabberStream *js, xmlnode *packet);
|
|
108 void jabber_send(JabberStream *js, xmlnode *data);
|
7642
|
109 void jabber_send_raw(JabberStream *js, const char *data, int len);
|
2086
|
110
|
7014
|
111 void jabber_stream_set_state(JabberStream *js, JabberStreamState state);
|
2086
|
112
|
7077
|
113 void jabber_register_parse(JabberStream *js, xmlnode *packet);
|
8016
|
114 void jabber_register_start(JabberStream *js);
|
7077
|
115
|
7014
|
116 char *jabber_get_next_id(JabberStream *js);
|
2086
|
117
|
8401
|
118 char *jabber_parse_error(JabberStream *js, xmlnode *packet);
|
|
119
|
7014
|
120 #endif /* _GAIM_JABBER_H_ */
|