annotate src/protocols/jabber/jabber.h @ 8995:9caf796e74aa

[gaim-migrate @ 9770] "Luke, if you get a chance, could you commit this? It should improve the HTML escaping situation between Gaim and other AIM and ICQ clients. I haven't actually applied it locally or tested it, but it looks ok to me. I would do it myself, but there are other changes in my oscar.c that aren't ready to commit, and I want to go to sleep so I can wake up tomorrow... I'll probably be out of town climbing until Sunday night... "--Mark Doliner "Below is an email I nearly sent you, before deciding to test & document the failure cases I knew of. http://www.nosnilmot.com/gaim/oscar-html.txt shows how current CVS behaves sending the string "<foo>" between GaimICQ/GaimAIM/ICQLite/WinAIM in various combinations After that testing I couldn't help trying to fix it :) The attached patch, from my testing, resolves all those marked with "XX" so that what is received matches what the user sent. The code might not be the most efficient and may contain redundant bits but I've had enough of this for now, 2 Windows crashes which caused VMWare to be weird and half break my keyboard and require restarting X. The patch might want a bit more testing, especially with iChat (I'm unable to test with that). Maybe committing it to CVS might get it some more testing though ;-)" --Stu Tomlinson committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 21 May 2004 11:55:08 +0000
parents c13a4913a071
children 4e7249591251
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
1 /**
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
2 * @file jabber.h
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
3 *
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
4 * gaim
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
5 *
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
6 * Copyright (C) 2003 Nathan Walp <faceprint@faceprint.com>
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 *
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
8 * This program is free software; you can redistribute it and/or modify
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
9 * it under the terms of the GNU General Public License as published by
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
11 * (at your option) any later version.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 *
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
13 * This program is distributed in the hope that it will be useful,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
16 * GNU General Public License for more details.
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 *
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
18 * You should have received a copy of the GNU General Public License
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
19 * along with this program; if not, write to the Free Software
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 */
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
22 #ifndef _GAIM_JABBER_H_
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
23 #define _GAIM_JABBER_H_
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
25 #include <glib.h>
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
26 #include "connection.h"
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8043
diff changeset
27 #include "roomlist.h"
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
28 #include "sslconn.h"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
29
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
30 #include "jutil.h"
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
31 #include "xmlnode.h"
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
33 typedef enum {
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
34 JABBER_CAP_NONE = 0,
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
35 JABBER_CAP_XHTML = 1 << 0,
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
36 JABBER_CAP_COMPOSING = 1 << 1,
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
37 JABBER_CAP_SI = 1 << 2,
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
38 JABBER_CAP_SI_FILE_XFER = 1 << 3,
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
39 JABBER_CAP_BYTESTREAMS = 1 << 4,
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
40 JABBER_CAP_IBB = 1 << 5,
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
41 JABBER_CAP_RETRIEVED = 1 << 31
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
42 } JabberCapabilities;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
43
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
44 typedef enum {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
45 JABBER_STREAM_OFFLINE,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
46 JABBER_STREAM_CONNECTING,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
47 JABBER_STREAM_INITIALIZING,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
48 JABBER_STREAM_AUTHENTICATING,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
49 JABBER_STREAM_REINITIALIZING,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
50 JABBER_STREAM_CONNECTED
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
51 } JabberStreamState;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
53 typedef struct _JabberStream
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54 {
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
55 int fd;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
57 GMarkupParseContext *context;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
58 xmlnode *current;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
59
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
60 enum {
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
61 JABBER_PROTO_0_9,
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
62 JABBER_PROTO_1_0
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
63 } protocol_version;
7291
632cee95cc5c [gaim-migrate @ 7872]
Nathan Walp <nwalp@pidgin.im>
parents: 7170
diff changeset
64 enum {
8296
dd6fe7d965aa [gaim-migrate @ 9020]
Nathan Walp <nwalp@pidgin.im>
parents: 8113
diff changeset
65 JABBER_AUTH_UNKNOWN,
7291
632cee95cc5c [gaim-migrate @ 7872]
Nathan Walp <nwalp@pidgin.im>
parents: 7170
diff changeset
66 JABBER_AUTH_DIGEST_MD5,
8296
dd6fe7d965aa [gaim-migrate @ 9020]
Nathan Walp <nwalp@pidgin.im>
parents: 8113
diff changeset
67 JABBER_AUTH_PLAIN,
dd6fe7d965aa [gaim-migrate @ 9020]
Nathan Walp <nwalp@pidgin.im>
parents: 8113
diff changeset
68 JABBER_AUTH_IQ_AUTH
7291
632cee95cc5c [gaim-migrate @ 7872]
Nathan Walp <nwalp@pidgin.im>
parents: 7170
diff changeset
69 } auth_type;
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
70 char *stream_id;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
71 JabberStreamState state;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
72
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
73 /* SASL authentication */
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
74 char *expected_rspauth;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
75
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
76 GHashTable *buddies;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
77 gboolean roster_parsed;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
79 GHashTable *chats;
8043
9a6df4d567e0 [gaim-migrate @ 8727]
Nathan Walp <nwalp@pidgin.im>
parents: 8016
diff changeset
80 GList *chat_servers;
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8043
diff changeset
81 GaimRoomlist *roomlist;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
83 GHashTable *iq_callbacks;
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
84 GHashTable *disco_callbacks;
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
85 int next_id;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86
8312
ba12d8b12ab0 [gaim-migrate @ 9036]
Nathan Walp <nwalp@pidgin.im>
parents: 8296
diff changeset
87
7395
b250288fa948 [gaim-migrate @ 7990]
Nathan Walp <nwalp@pidgin.im>
parents: 7291
diff changeset
88 GList *oob_file_transfers;
7170
1cf80749f2f0 [gaim-migrate @ 7737]
Nathan Walp <nwalp@pidgin.im>
parents: 7077
diff changeset
89 GList *file_transfers;
1cf80749f2f0 [gaim-migrate @ 7737]
Nathan Walp <nwalp@pidgin.im>
parents: 7077
diff changeset
90
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
91 time_t idle;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
93 JabberID *user;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
94 GaimConnection *gc;
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
95 GaimSslConnection *gsc;
7072
1350352f5818 [gaim-migrate @ 7637]
Nathan Walp <nwalp@pidgin.im>
parents: 7014
diff changeset
96
1350352f5818 [gaim-migrate @ 7637]
Nathan Walp <nwalp@pidgin.im>
parents: 7014
diff changeset
97 gboolean registration;
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
98 } JabberStream;
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
100 void jabber_process_packet(JabberStream *js, xmlnode *packet);
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
101 void jabber_send(JabberStream *js, xmlnode *data);
7642
9008b5be4275 [gaim-migrate @ 8285]
Nathan Walp <nwalp@pidgin.im>
parents: 7395
diff changeset
102 void jabber_send_raw(JabberStream *js, const char *data, int len);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
104 void jabber_stream_set_state(JabberStream *js, JabberStreamState state);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105
7077
6d10bf28be0e [gaim-migrate @ 7642]
Nathan Walp <nwalp@pidgin.im>
parents: 7072
diff changeset
106 void jabber_register_parse(JabberStream *js, xmlnode *packet);
8016
7bae464195c4 [gaim-migrate @ 8696]
Nathan Walp <nwalp@pidgin.im>
parents: 7642
diff changeset
107 void jabber_register_start(JabberStream *js);
7077
6d10bf28be0e [gaim-migrate @ 7642]
Nathan Walp <nwalp@pidgin.im>
parents: 7072
diff changeset
108
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
109 char *jabber_get_next_id(JabberStream *js);
2086
424a40f12a6c [gaim-migrate @ 2096]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110
8401
c13a4913a071 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
111 char *jabber_parse_error(JabberStream *js, xmlnode *packet);
c13a4913a071 [gaim-migrate @ 9130]
Nathan Walp <nwalp@pidgin.im>
parents: 8312
diff changeset
112
7014
67c4e9d39242 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents: 3717
diff changeset
113 #endif /* _GAIM_JABBER_H_ */