changeset 23884:08c50482d5a2

Only disconnect xmpp connections during xml parsing if the error is an unrecoverable/fatal error. Fixes #6634
author Stu Tomlinson <stu@nosnilmot.com>
date Fri, 22 Aug 2008 20:54:24 +0000
parents 0525d448ee8c
children afdbb628fd17
files libpurple/protocols/jabber/parser.c
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/parser.c	Fri Aug 22 01:55:21 2008 +0000
+++ b/libpurple/protocols/jabber/parser.c	Fri Aug 22 20:54:24 2008 +0000
@@ -207,13 +207,11 @@
 		js->context = xmlCreatePushParserCtxt(&jabber_parser_libxml, js, buf, len, NULL);
 		xmlParseChunk(js->context, "", 0, 0);
 	} else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) {
-		purple_debug_error("jabber", "xmlParseChunk returned error %i", ret);
+		xmlError *err = xmlCtxtGetLastError(js->context);
 
-		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_debug_error("jabber", "xmlParseChunk returned error %i\n", ret);
+
+		if (err->level == XML_ERR_FATAL) {
 			purple_connection_error_reason (js->gc,
 				PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
 				_("XML Parse error"));