summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Schoenberg <evands@pidgin.im>2008-07-04 16:14:35 +0000
committerEvan Schoenberg <evands@pidgin.im>2008-07-04 16:14:35 +0000
commitbcfb5c3a0632bca0f01be3a0af262ca9d231aa7c (patch)
tree473b327049f5fabb53c8fb03f50d4659fda785d0
parentbe00fc1a8d01a101818c8611912c36d026e24e18 (diff)
downloadpidgin-bcfb5c3a0632bca0f01be3a0af262ca9d231aa7c.tar.gz
Drop and then recover from XML messages which trigger invalid character
errors rather than disconnecting.
-rw-r--r--libpurple/protocols/jabber/parser.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libpurple/protocols/jabber/parser.c b/libpurple/protocols/jabber/parser.c
index 59f76dd3ee..d9043c8ba4 100644
--- a/libpurple/protocols/jabber/parser.c
+++ b/libpurple/protocols/jabber/parser.c
@@ -209,9 +209,15 @@ void jabber_parser_process(JabberStream *js, const char *buf, int len)
} else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) {
purple_debug_error("jabber", "xmlParseChunk returned error %i", ret);
- purple_connection_error_reason (js->gc,
- PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
- _("XML Parse error"));
+ if ((ret >= XML_ERR_INVALID_HEX_CHARREF) && (ret <= XML_ERR_INVALID_CHAR)) {
+ /* If the error involves an invalid character, just drop this message.
+ * We'll create a new parser next time it's needed. */
+ jabber_parser_free(js);
+ } else {
+ purple_connection_error_reason (js->gc,
+ PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+ _("XML Parse error"));
+ }
}
}