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"
|
|
27 #include "sslconn.h"
|
2086
|
28
|
7014
|
29 #include "jutil.h"
|
|
30 #include "xmlnode.h"
|
2086
|
31
|
7014
|
32 typedef enum {
|
|
33 JABBER_STREAM_OFFLINE,
|
|
34 JABBER_STREAM_CONNECTING,
|
|
35 JABBER_STREAM_INITIALIZING,
|
|
36 JABBER_STREAM_AUTHENTICATING,
|
|
37 JABBER_STREAM_REINITIALIZING,
|
|
38 JABBER_STREAM_CONNECTED
|
|
39 } JabberStreamState;
|
2086
|
40
|
7014
|
41 typedef struct _JabberStream
|
2086
|
42 {
|
7014
|
43 int fd;
|
2086
|
44
|
7014
|
45 GMarkupParseContext *context;
|
|
46 xmlnode *current;
|
2086
|
47
|
7014
|
48 enum {
|
|
49 JABBER_PROTO_0_9,
|
|
50 JABBER_PROTO_1_0
|
|
51 } protocol_version;
|
7291
|
52 enum {
|
|
53 JABBER_AUTH_NONE,
|
|
54 JABBER_AUTH_DIGEST_MD5,
|
|
55 JABBER_AUTH_PLAIN
|
|
56 } auth_type;
|
7014
|
57 char *stream_id;
|
|
58 JabberStreamState state;
|
2086
|
59
|
7014
|
60 /* SASL authentication */
|
|
61 char *expected_rspauth;
|
2086
|
62
|
7014
|
63 GHashTable *buddies;
|
|
64 gboolean roster_parsed;
|
2086
|
65
|
7014
|
66 GHashTable *chats;
|
2086
|
67
|
7014
|
68 GHashTable *callbacks;
|
|
69 int next_id;
|
2086
|
70
|
7170
|
71 GList *file_transfers;
|
|
72
|
7014
|
73 time_t idle;
|
2086
|
74
|
7014
|
75 JabberID *user;
|
|
76 GaimConnection *gc;
|
|
77 GaimSslConnection *gsc;
|
7072
|
78
|
|
79 gboolean registration;
|
7014
|
80 } JabberStream;
|
2086
|
81
|
7014
|
82 typedef void (JabberCallback)(JabberStream *js, xmlnode *packet);
|
2086
|
83
|
7014
|
84 void jabber_process_packet(JabberStream *js, xmlnode *packet);
|
|
85 void jabber_send(JabberStream *js, xmlnode *data);
|
|
86 void jabber_send_raw(JabberStream *js, const char *data);
|
2086
|
87
|
7014
|
88 void jabber_stream_set_state(JabberStream *js, JabberStreamState state);
|
2086
|
89
|
7077
|
90 void jabber_register_parse(JabberStream *js, xmlnode *packet);
|
|
91
|
7014
|
92 char *jabber_get_next_id(JabberStream *js);
|
2086
|
93
|
7014
|
94 #endif /* _GAIM_JABBER_H_ */
|