Mon, 11 Mar 2024 04:29:48 -0500
Explicitly cast libxml error handler function
Depending on compiler options, the `const` → non-`const` argument can fail in just the same way as it did in reverse. So add an explicit cast to silence that.
Testing Done:
Compiled with `gcc` and `clang` on a system with older libxml2, which still had the non-`const` type. There, `gcc` raises a warning, but `clang` seems to think this is a fatal error.
Reviewed at https://reviews.imfreedom.org/r/3016/
| 7014 | 1 | /* |
| 15884 | 2 | * purple - Jabber XML parser stuff |
| 7014 | 3 | * |
|
28322
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
27361
diff
changeset
|
6 | * source distribution. |
| 7014 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15884
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 7014 | 21 | * |
| 22 | */ | |
|
40439
e9838d634d5e
Make sure that internal.h can only be included by libpurple and split out some pieces to purpleprivate.h
Gary Kramlich <grim@reaperworld.com>
parents:
40358
diff
changeset
|
23 | #include <glib/gi18n-lib.h> |
| 7014 | 24 | |
| 13808 | 25 | #include <libxml/parser.h> |
| 26 | ||
|
40358
e6fe6fc1f516
move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents:
38855
diff
changeset
|
27 | #include <purple.h> |
|
e6fe6fc1f516
move all protocols, purple plugins, and purple tests to use purple.h instead of including files individually
Gary Kramlich <grim@reaperworld.com>
parents:
38855
diff
changeset
|
28 | |
| 7014 | 29 | #include "jabber.h" |
| 30 | #include "parser.h" | |
| 31 | ||
| 13808 | 32 | static void |
| 33 | jabber_parser_element_start_libxml(void *user_data, | |
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
34 | const xmlChar *element_name, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
35 | const xmlChar *prefix, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
36 | const xmlChar *namespace, int nb_namespaces, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
37 | const xmlChar **namespaces, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
38 | int nb_attributes, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
39 | G_GNUC_UNUSED int nb_defaulted, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
40 | const xmlChar **attributes) |
| 13808 | 41 | { |
| 42 | JabberStream *js = user_data; | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
43 | PurpleXmlNode *node; |
|
25288
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
44 | int i, j; |
| 13808 | 45 | |
| 46 | if(!element_name) { | |
| 47 | return; | |
|
29865
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
48 | } else if (js->stream_id == NULL) { |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
49 | /* Sanity checking! */ |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
50 | if (0 != xmlStrcmp(element_name, (xmlChar *) "stream") || |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
51 | 0 != xmlStrcmp(namespace, (xmlChar *) NS_XMPP_STREAMS)) { |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
52 | /* We were expecting a <stream:stream/> opening stanza, but |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
53 | * didn't get it. Bad! |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
54 | */ |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
55 | purple_debug_error("jabber", "Expecting stream header, got %s with " |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
56 | "xmlns %s\n", element_name, namespace); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31294
diff
changeset
|
57 | purple_connection_error(js->gc, |
|
29865
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
58 | PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
59 | _("XMPP stream header missing")); |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
60 | return; |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
61 | } |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
62 | |
|
29849
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29697
diff
changeset
|
63 | js->protocol_version.major = 0; |
|
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29697
diff
changeset
|
64 | js->protocol_version.minor = 9; |
|
29865
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
65 | |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
66 | for (i = 0; i < nb_attributes * 5; i += 5) { |
| 13808 | 67 | int attrib_len = attributes[i+4] - attributes[i+3]; |
|
29057
a8de6baeee63
Use g_strndup() for great justice.
Paul Aurich <darkrain42@pidgin.im>
parents:
29025
diff
changeset
|
68 | char *attrib = g_strndup((gchar *)attributes[i+3], attrib_len); |
|
14498
ede839a78714
[gaim-migrate @ 17150]
Mark Doliner <markdoliner@pidgin.im>
parents:
14476
diff
changeset
|
69 | |
|
29849
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29697
diff
changeset
|
70 | if(!xmlStrcmp(attributes[i], (xmlChar*) "version")) { |
|
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29697
diff
changeset
|
71 | const char *dot = strchr(attrib, '.'); |
|
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29697
diff
changeset
|
72 | |
|
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29697
diff
changeset
|
73 | js->protocol_version.major = atoi(attrib); |
|
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29697
diff
changeset
|
74 | js->protocol_version.minor = dot ? atoi(dot + 1) : 0; |
|
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29697
diff
changeset
|
75 | |
|
29865
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
76 | if (js->protocol_version.major > 1) { |
|
29852
54a66e3ae00e
jabber: Connected again; checked section 5.4.5 of the bis.
Paul Aurich <darkrain42@pidgin.im>
parents:
29851
diff
changeset
|
77 | /* TODO: Send <unsupported-version/> error */ |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31294
diff
changeset
|
78 | purple_connection_error(js->gc, |
|
29849
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29697
diff
changeset
|
79 | PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE, |
|
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29697
diff
changeset
|
80 | _("XMPP Version Mismatch")); |
|
29865
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
81 | g_free(attrib); |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
82 | return; |
|
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
83 | } |
|
29850
a7b5b8035f30
jabber: Backward compatibility in case any servers advertise other random 0.## versions
Paul Aurich <darkrain42@pidgin.im>
parents:
29849
diff
changeset
|
84 | |
|
a7b5b8035f30
jabber: Backward compatibility in case any servers advertise other random 0.## versions
Paul Aurich <darkrain42@pidgin.im>
parents:
29849
diff
changeset
|
85 | if (js->protocol_version.major == 0 && js->protocol_version.minor != 9) { |
|
a7b5b8035f30
jabber: Backward compatibility in case any servers advertise other random 0.## versions
Paul Aurich <darkrain42@pidgin.im>
parents:
29849
diff
changeset
|
86 | purple_debug_warning("jabber", "Treating version %s as 0.9 for backward " |
|
a7b5b8035f30
jabber: Backward compatibility in case any servers advertise other random 0.## versions
Paul Aurich <darkrain42@pidgin.im>
parents:
29849
diff
changeset
|
87 | "compatibility\n", attrib); |
|
a7b5b8035f30
jabber: Backward compatibility in case any servers advertise other random 0.## versions
Paul Aurich <darkrain42@pidgin.im>
parents:
29849
diff
changeset
|
88 | } |
|
a7b5b8035f30
jabber: Backward compatibility in case any servers advertise other random 0.## versions
Paul Aurich <darkrain42@pidgin.im>
parents:
29849
diff
changeset
|
89 | g_free(attrib); |
|
14690
9287ecc4adb1
[gaim-migrate @ 17369]
Daniel Atallah <datallah@pidgin.im>
parents:
14685
diff
changeset
|
90 | } else if(!xmlStrcmp(attributes[i], (xmlChar*) "id")) { |
|
15698
bcec3cb58d30
Patch from MatsMattsson (Adium Trac #6429) which fixes a leak of attrib for any attribute that isn't 'id' or 'version'.
Evan Schoenberg <evands@pidgin.im>
parents:
15558
diff
changeset
|
91 | g_free(js->stream_id); |
|
14685
7622a9ca1794
[gaim-migrate @ 17352]
Daniel Atallah <datallah@pidgin.im>
parents:
14538
diff
changeset
|
92 | js->stream_id = attrib; |
|
15698
bcec3cb58d30
Patch from MatsMattsson (Adium Trac #6429) which fixes a leak of attrib for any attribute that isn't 'id' or 'version'.
Evan Schoenberg <evands@pidgin.im>
parents:
15558
diff
changeset
|
93 | } else { |
|
25288
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
94 | g_free(attrib); |
| 13808 | 95 | } |
| 96 | } | |
|
29865
3a23d291568e
jabber: Clear the stream header when restarting a stream, and be
Paul Aurich <darkrain42@pidgin.im>
parents:
29852
diff
changeset
|
97 | |
|
30724
aec4b368087d
jabber: Make the reliance on stream ID laxer. Closes #12331
Paul Aurich <darkrain42@pidgin.im>
parents:
29865
diff
changeset
|
98 | if (js->stream_id == NULL) { |
|
38855
efb399171679
Clean up a comment that didn't make sense any more
Gary Kramlich <grim@reaperworld.com>
parents:
38854
diff
changeset
|
99 | /* Let's make up a placeholder stream ID, which we need to do |
|
efb399171679
Clean up a comment that didn't make sense any more
Gary Kramlich <grim@reaperworld.com>
parents:
38854
diff
changeset
|
100 | * because we flag on it being NULL as a special case in this |
|
efb399171679
Clean up a comment that didn't make sense any more
Gary Kramlich <grim@reaperworld.com>
parents:
38854
diff
changeset
|
101 | * parsing code. |
|
30724
aec4b368087d
jabber: Make the reliance on stream ID laxer. Closes #12331
Paul Aurich <darkrain42@pidgin.im>
parents:
29865
diff
changeset
|
102 | */ |
|
30741
08f776e14719
jabber: Slight improvements to the stream ID fix
Paul Aurich <darkrain42@pidgin.im>
parents:
30724
diff
changeset
|
103 | js->stream_id = g_strdup(""); |
|
08f776e14719
jabber: Slight improvements to the stream ID fix
Paul Aurich <darkrain42@pidgin.im>
parents:
30724
diff
changeset
|
104 | purple_debug_info("jabber", "Server failed to specify a stream " |
|
08f776e14719
jabber: Slight improvements to the stream ID fix
Paul Aurich <darkrain42@pidgin.im>
parents:
30724
diff
changeset
|
105 | "ID (underspecified in rfc3920, but intended " |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30822
diff
changeset
|
106 | "to be a MUST; digest legacy auth may fail.\n"); |
|
30724
aec4b368087d
jabber: Make the reliance on stream ID laxer. Closes #12331
Paul Aurich <darkrain42@pidgin.im>
parents:
29865
diff
changeset
|
107 | } |
| 13808 | 108 | } else { |
| 109 | ||
| 110 | if(js->current) | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
111 | node = purple_xmlnode_new_child(js->current, (const char*) element_name); |
| 13808 | 112 | else |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
113 | node = purple_xmlnode_new((const char*) element_name); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
114 | purple_xmlnode_set_namespace(node, (const char*) namespace); |
|
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
115 | purple_xmlnode_set_prefix(node, (const char *)prefix); |
| 13808 | 116 | |
|
25288
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
117 | if (nb_namespaces != 0) { |
|
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
118 | node->namespace_map = g_hash_table_new_full( |
|
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
119 | g_str_hash, g_str_equal, g_free, g_free); |
|
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
120 | |
|
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
121 | for (i = 0, j = 0; i < nb_namespaces; i++, j += 2) { |
|
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
122 | const char *key = (const char *)namespaces[j]; |
|
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
123 | const char *val = (const char *)namespaces[j + 1]; |
|
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
124 | g_hash_table_insert(node->namespace_map, |
|
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
125 | g_strdup(key ? key : ""), g_strdup(val ? val : "")); |
|
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
126 | } |
|
2cd805f52348
Don't ignore XML namespace and prefix information when parsing incoming XMPP
Michal Witkowski <neuro@o2.pl>
parents:
24738
diff
changeset
|
127 | } |
| 13808 | 128 | for(i=0; i < nb_attributes * 5; i+=5) { |
|
26393
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25620
diff
changeset
|
129 | const char *name = (const char *)attributes[i]; |
|
7420fd99903a
Add xmlnode_set_attrib_full that enables you to set an attribute with both
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25620
diff
changeset
|
130 | const char *prefix = (const char *)attributes[i+1]; |
|
25620
fb9118dea0ed
Don't set an attribute prefix on the node, and remove an unnecessary call
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25365
diff
changeset
|
131 | const char *attrib_ns = (const char *)attributes[i+2]; |
| 15158 | 132 | char *txt; |
| 13808 | 133 | int attrib_len = attributes[i+4] - attributes[i+3]; |
|
29057
a8de6baeee63
Use g_strndup() for great justice.
Paul Aurich <darkrain42@pidgin.im>
parents:
29025
diff
changeset
|
134 | char *attrib = g_strndup((gchar *)attributes[i+3], attrib_len); |
| 15265 | 135 | |
| 15158 | 136 | txt = attrib; |
|
29328
cf4435714f5f
Correctly parse "<br>" in an XML attribute. Closes #11318.
Paul Aurich <darkrain42@pidgin.im>
parents:
29085
diff
changeset
|
137 | attrib = purple_unescape_text(txt); |
| 15158 | 138 | g_free(txt); |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
139 | purple_xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib); |
| 13808 | 140 | g_free(attrib); |
| 141 | } | |
| 142 | ||
| 143 | js->current = node; | |
| 144 | } | |
| 145 | } | |
| 146 | ||
| 147 | static void | |
|
14498
ede839a78714
[gaim-migrate @ 17150]
Mark Doliner <markdoliner@pidgin.im>
parents:
14476
diff
changeset
|
148 | jabber_parser_element_end_libxml(void *user_data, const xmlChar *element_name, |
|
41967
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
149 | G_GNUC_UNUSED const xmlChar *prefix, |
|
025eee9e6f1d
Bump C standard to C99 for XMPP and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40439
diff
changeset
|
150 | G_GNUC_UNUSED const xmlChar *namespace) |
| 13808 | 151 | { |
| 152 | JabberStream *js = user_data; | |
| 153 | ||
| 154 | if(!js->current) | |
| 155 | return; | |
| 156 | ||
| 157 | if(js->current->parent) { | |
|
14690
9287ecc4adb1
[gaim-migrate @ 17369]
Daniel Atallah <datallah@pidgin.im>
parents:
14685
diff
changeset
|
158 | if(!xmlStrcmp((xmlChar*) js->current->name, element_name)) |
| 13808 | 159 | js->current = js->current->parent; |
| 160 | } else { | |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
161 | PurpleXmlNode *packet = js->current; |
| 13808 | 162 | js->current = NULL; |
|
17828
6957bf9d7330
Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
Andreas Monitzer <am@adiumx.com>
parents:
17813
diff
changeset
|
163 | jabber_process_packet(js, &packet); |
|
24738
b642b5aa2a42
Don't try to free NULL xmlnodes stolen by jabber-receiving-xmlnode handlers
Will Thompson <resiak@pidgin.im>
parents:
24706
diff
changeset
|
164 | if (packet != NULL) |
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
165 | purple_xmlnode_free(packet); |
| 13808 | 166 | } |
| 167 | } | |
| 168 | ||
| 169 | static void | |
| 170 | jabber_parser_element_text_libxml(void *user_data, const xmlChar *text, int text_len) | |
| 171 | { | |
| 172 | JabberStream *js = user_data; | |
| 173 | ||
| 174 | if(!js->current) | |
| 175 | return; | |
| 176 | ||
| 177 | if(!text || !text_len) | |
| 178 | return; | |
| 179 | ||
|
34935
686fa55b0deb
Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents:
34766
diff
changeset
|
180 | purple_xmlnode_insert_data(js->current, (const char*) text, text_len); |
| 13808 | 181 | } |
| 182 | ||
|
23567
9189d89be26f
Added a structured error handler callback to the xmlSAXHandler struct.
Evan Schoenberg <evands@pidgin.im>
parents:
23077
diff
changeset
|
183 | static void |
|
42590
452ba49e16d4
Fix incompatible type conversion errors
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41967
diff
changeset
|
184 | jabber_parser_structured_error_handler(void *user_data, const xmlError *error) |
|
23567
9189d89be26f
Added a structured error handler callback to the xmlSAXHandler struct.
Evan Schoenberg <evands@pidgin.im>
parents:
23077
diff
changeset
|
185 | { |
|
9189d89be26f
Added a structured error handler callback to the xmlSAXHandler struct.
Evan Schoenberg <evands@pidgin.im>
parents:
23077
diff
changeset
|
186 | JabberStream *js = user_data; |
|
9189d89be26f
Added a structured error handler callback to the xmlSAXHandler struct.
Evan Schoenberg <evands@pidgin.im>
parents:
23077
diff
changeset
|
187 | |
| 38260 | 188 | if (error->level == XML_ERR_WARNING |
|
38256
035f00c4fd87
Replace misused g_str_equal() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
31294
diff
changeset
|
189 | && purple_strequal(error->message, "xmlns: URI vcard-temp is not absolute\n")) |
|
24703
26998f3425f7
Don't log an error when parsing vcard data. Also, these messages
Mark Doliner <markdoliner@pidgin.im>
parents:
24149
diff
changeset
|
190 | /* |
|
26998f3425f7
Don't log an error when parsing vcard data. Also, these messages
Mark Doliner <markdoliner@pidgin.im>
parents:
24149
diff
changeset
|
191 | * This message happens when parsing vcards, and is normal, so don't |
|
26998f3425f7
Don't log an error when parsing vcard data. Also, these messages
Mark Doliner <markdoliner@pidgin.im>
parents:
24149
diff
changeset
|
192 | * bother logging it because people scare easily. |
|
26998f3425f7
Don't log an error when parsing vcard data. Also, these messages
Mark Doliner <markdoliner@pidgin.im>
parents:
24149
diff
changeset
|
193 | */ |
|
26998f3425f7
Don't log an error when parsing vcard data. Also, these messages
Mark Doliner <markdoliner@pidgin.im>
parents:
24149
diff
changeset
|
194 | return; |
|
26998f3425f7
Don't log an error when parsing vcard data. Also, these messages
Mark Doliner <markdoliner@pidgin.im>
parents:
24149
diff
changeset
|
195 | |
|
29058
48b95d503303
jabber: Use the error code instead of string matching.
Paul Aurich <darkrain42@pidgin.im>
parents:
29057
diff
changeset
|
196 | if (error->level == XML_ERR_FATAL && error->code == XML_ERR_DOCUMENT_END) |
|
28986
57ed606f526d
jabber: Don't print "Extra content at the end of the document".
Paul Aurich <darkrain42@pidgin.im>
parents:
28623
diff
changeset
|
197 | /* |
|
57ed606f526d
jabber: Don't print "Extra content at the end of the document".
Paul Aurich <darkrain42@pidgin.im>
parents:
28623
diff
changeset
|
198 | * This is probably more annoying than the vcard-temp error; it occurs |
|
57ed606f526d
jabber: Don't print "Extra content at the end of the document".
Paul Aurich <darkrain42@pidgin.im>
parents:
28623
diff
changeset
|
199 | * because we disconnect in most cases without waiting for the receiving |
|
57ed606f526d
jabber: Don't print "Extra content at the end of the document".
Paul Aurich <darkrain42@pidgin.im>
parents:
28623
diff
changeset
|
200 | * </stream:stream> (limitations of libpurple) |
|
57ed606f526d
jabber: Don't print "Extra content at the end of the document".
Paul Aurich <darkrain42@pidgin.im>
parents:
28623
diff
changeset
|
201 | */ |
|
57ed606f526d
jabber: Don't print "Extra content at the end of the document".
Paul Aurich <darkrain42@pidgin.im>
parents:
28623
diff
changeset
|
202 | return; |
|
57ed606f526d
jabber: Don't print "Extra content at the end of the document".
Paul Aurich <darkrain42@pidgin.im>
parents:
28623
diff
changeset
|
203 | |
|
23567
9189d89be26f
Added a structured error handler callback to the xmlSAXHandler struct.
Evan Schoenberg <evands@pidgin.im>
parents:
23077
diff
changeset
|
204 | purple_debug_error("jabber", "XML parser error for JabberStream %p: " |
|
24703
26998f3425f7
Don't log an error when parsing vcard data. Also, these messages
Mark Doliner <markdoliner@pidgin.im>
parents:
24149
diff
changeset
|
205 | "Domain %i, code %i, level %i: %s", |
|
23567
9189d89be26f
Added a structured error handler callback to the xmlSAXHandler struct.
Evan Schoenberg <evands@pidgin.im>
parents:
23077
diff
changeset
|
206 | js, |
|
9189d89be26f
Added a structured error handler callback to the xmlSAXHandler struct.
Evan Schoenberg <evands@pidgin.im>
parents:
23077
diff
changeset
|
207 | error->domain, error->code, error->level, |
|
24706
9fbd313398fe
I know Mark was trying to save newlines, but I had one to spare.
Richard Laager <rlaager@pidgin.im>
parents:
24703
diff
changeset
|
208 | (error->message ? error->message : "(null)\n")); |
|
23567
9189d89be26f
Added a structured error handler callback to the xmlSAXHandler struct.
Evan Schoenberg <evands@pidgin.im>
parents:
23077
diff
changeset
|
209 | } |
|
9189d89be26f
Added a structured error handler callback to the xmlSAXHandler struct.
Evan Schoenberg <evands@pidgin.im>
parents:
23077
diff
changeset
|
210 | |
| 13808 | 211 | static xmlSAXHandler jabber_parser_libxml = { |
|
23077
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
212 | NULL, /*internalSubset*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
213 | NULL, /*isStandalone*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
214 | NULL, /*hasInternalSubset*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
215 | NULL, /*hasExternalSubset*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
216 | NULL, /*resolveEntity*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
217 | NULL, /*getEntity*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
218 | NULL, /*entityDecl*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
219 | NULL, /*notationDecl*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
220 | NULL, /*attributeDecl*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
221 | NULL, /*elementDecl*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
222 | NULL, /*unparsedEntityDecl*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
223 | NULL, /*setDocumentLocator*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
224 | NULL, /*startDocument*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
225 | NULL, /*endDocument*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
226 | NULL, /*startElement*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
227 | NULL, /*endElement*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
228 | NULL, /*reference*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
229 | jabber_parser_element_text_libxml, /*characters*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
230 | NULL, /*ignorableWhitespace*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
231 | NULL, /*processingInstruction*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
232 | NULL, /*comment*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
233 | NULL, /*warning*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
234 | NULL, /*error*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
235 | NULL, /*fatalError*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
236 | NULL, /*getParameterEntity*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
237 | NULL, /*cdataBlock*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
238 | NULL, /*externalSubset*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
239 | XML_SAX2_MAGIC, /*initialized*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
240 | NULL, /*_private*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
241 | jabber_parser_element_start_libxml, /*startElementNs*/ |
|
431e35debb40
Using named elements in a struct initialization doesn't work in MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
21279
diff
changeset
|
242 | jabber_parser_element_end_libxml, /*endElementNs*/ |
|
42631
6628810f3fe8
Explicitly cast libxml error handler function
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42590
diff
changeset
|
243 | (xmlStructuredErrorFunc)jabber_parser_structured_error_handler /*serror*/ |
| 13808 | 244 | }; |
| 7014 | 245 | |
| 246 | void | |
| 247 | jabber_parser_setup(JabberStream *js) | |
| 248 | { | |
| 14538 | 249 | /* This seems backwards, but it makes sense. The libxml code creates |
| 250 | * the parser context when you try to use it (this way, it can figure | |
| 251 | * out the encoding at creation time. So, setting up the parser is | |
| 252 | * just a matter of destroying any current parser. */ | |
|
17810
c8d4297080cb
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <am@adiumx.com>
parents:
15884
diff
changeset
|
253 | jabber_parser_free(js); |
|
c8d4297080cb
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <am@adiumx.com>
parents:
15884
diff
changeset
|
254 | } |
|
c8d4297080cb
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <am@adiumx.com>
parents:
15884
diff
changeset
|
255 | |
|
c8d4297080cb
Fixed a leak: The XML parser was never cleaned up on disconnect.
Andreas Monitzer <am@adiumx.com>
parents:
15884
diff
changeset
|
256 | void jabber_parser_free(JabberStream *js) { |
| 13808 | 257 | if (js->context) { |
| 258 | xmlParseChunk(js->context, NULL,0,1); | |
| 259 | xmlFreeParserCtxt(js->context); | |
| 260 | js->context = NULL; | |
| 261 | } | |
| 7014 | 262 | } |
| 263 | ||
| 264 | void jabber_parser_process(JabberStream *js, const char *buf, int len) | |
| 265 | { | |
|
23568
bd3e623fa265
xmlParseChunk() never returns less than 0. It retusn an error code from
Evan Schoenberg <evands@pidgin.im>
parents:
23567
diff
changeset
|
266 | int ret; |
|
bd3e623fa265
xmlParseChunk() never returns less than 0. It retusn an error code from
Evan Schoenberg <evands@pidgin.im>
parents:
23567
diff
changeset
|
267 | |
| 23570 | 268 | if (js->context == NULL) { |
| 14538 | 269 | /* libxml inconsistently starts parsing on creating the |
| 270 | * parser, so do a ParseChunk right afterwards to force it. */ | |
| 13808 | 271 | js->context = xmlCreatePushParserCtxt(&jabber_parser_libxml, js, buf, len, NULL); |
| 14700 | 272 | xmlParseChunk(js->context, "", 0, 0); |
|
23568
bd3e623fa265
xmlParseChunk() never returns less than 0. It retusn an error code from
Evan Schoenberg <evands@pidgin.im>
parents:
23567
diff
changeset
|
273 | } else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) { |
|
42590
452ba49e16d4
Fix incompatible type conversion errors
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41967
diff
changeset
|
274 | const xmlError *err = xmlCtxtGetLastError(js->context); |
|
25726
19e0c9302a43
*** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25620
diff
changeset
|
275 | /* |
|
19e0c9302a43
*** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25620
diff
changeset
|
276 | * libxml2 uses a global setting to determine whether or not to store |
|
19e0c9302a43
*** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25620
diff
changeset
|
277 | * warnings. Other libraries may set this, which causes err to be |
|
19e0c9302a43
*** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25620
diff
changeset
|
278 | * NULL. See #8136 for details. |
|
19e0c9302a43
*** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25620
diff
changeset
|
279 | */ |
|
19e0c9302a43
*** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25620
diff
changeset
|
280 | xmlErrorLevel level = XML_ERR_WARNING; |
|
23568
bd3e623fa265
xmlParseChunk() never returns less than 0. It retusn an error code from
Evan Schoenberg <evands@pidgin.im>
parents:
23567
diff
changeset
|
281 | |
|
25726
19e0c9302a43
*** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25620
diff
changeset
|
282 | if (err) |
|
19e0c9302a43
*** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25620
diff
changeset
|
283 | level = err->level; |
|
19e0c9302a43
*** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25620
diff
changeset
|
284 | |
|
19e0c9302a43
*** Plucked rev d34a1589 (darkrain42@pidgin.im):
Paul Aurich <darkrain42@pidgin.im>
parents:
25620
diff
changeset
|
285 | switch (level) { |
|
25365
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
286 | case XML_ERR_NONE: |
|
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
287 | purple_debug_info("jabber", "xmlParseChunk returned info %i\n", ret); |
|
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
288 | break; |
|
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
289 | case XML_ERR_WARNING: |
|
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
290 | purple_debug_warning("jabber", "xmlParseChunk returned warning %i\n", ret); |
|
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
291 | break; |
|
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
292 | case XML_ERR_ERROR: |
|
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
293 | purple_debug_error("jabber", "xmlParseChunk returned error %i\n", ret); |
|
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
294 | break; |
|
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
295 | case XML_ERR_FATAL: |
|
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
296 | purple_debug_error("jabber", "xmlParseChunk returned fatal %i\n", ret); |
|
32157
39ba2e2492ee
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents:
31294
diff
changeset
|
297 | purple_connection_error (js->gc, |
|
25365
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
298 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
299 | _("XML Parse error")); |
|
e941a99c74b3
Make XML parsing error levels match libxml2's levels, making less important
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
25288
diff
changeset
|
300 | break; |
|
23569
b76c41ef45d4
Drop and then recover from XML messages which trigger invalid character
Evan Schoenberg <evands@pidgin.im>
parents:
23568
diff
changeset
|
301 | } |
| 13808 | 302 | } |
|
28623
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
303 | |
|
29849
d7b910200dc5
jabber: Treat the version properly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29697
diff
changeset
|
304 | if (js->protocol_version.major == 0 && js->protocol_version.minor == 9 && |
|
35042
c284eef5cd26
Added purple_connection_get_error_info()
Ankit Vani <a@nevitus.org>
parents:
34935
diff
changeset
|
305 | !purple_connection_get_error_info(js->gc) && |
|
28623
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
306 | (js->state == JABBER_STREAM_INITIALIZING || |
|
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
307 | js->state == JABBER_STREAM_INITIALIZING_ENCRYPTION)) { |
|
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
308 | /* |
|
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
309 | * Legacy servers don't advertise features, so if we've just gotten |
|
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
310 | * the opening <stream:stream> and there was no version, we need to |
|
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
311 | * immediately start legacy IQ auth. |
|
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
312 | */ |
|
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
313 | jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); |
|
28855
c5bc85f9c00e
jabber: Factor the SASL auth methods into their own files.
Paul Aurich <darkrain42@pidgin.im>
parents:
28623
diff
changeset
|
314 | jabber_auth_start_old(js); |
|
28623
4f7f9d7bb23d
jabber: Re-arrange the code that detects legacy servers so that we don't stomp over "Host Unknown" errors.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
315 | } |
| 7014 | 316 | } |
| 317 |