changeset 23426:ce361cc8e43b

Drop and then recover from XML messages which trigger invalid character errors rather than disconnecting.
author Evan Schoenberg <evan.s@dreskin.net>
date Fri, 04 Jul 2008 16:14:35 +0000
parents 0eca6c183d60
children 76dbcdd86fe2
files libpurple/protocols/jabber/parser.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/parser.c	Fri Jul 04 16:07:20 2008 +0000
+++ b/libpurple/protocols/jabber/parser.c	Fri Jul 04 16:14:35 2008 +0000
@@ -209,9 +209,15 @@
 	} 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"));
+		}
 	}
 }