changeset 23426:1b3aea146613

Added a structured error handler callback to the xmlSAXHandler struct. This callback is used preferentially over the warning/error/fatal_error callbacks (whcih we don't implement, anyways) for 'modules which support the new error reporting mechanism'. This should help us detect parsing errors.
author Evan Schoenberg <evan.s@dreskin.net>
date Fri, 04 Jul 2008 15:41:26 +0000
parents a2f63b74fe31
children 0eca6c183d60
files libpurple/protocols/jabber/parser.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/parser.c	Thu Jul 03 19:53:31 2008 +0000
+++ b/libpurple/protocols/jabber/parser.c	Fri Jul 04 15:41:26 2008 +0000
@@ -132,6 +132,18 @@
 	xmlnode_insert_data(js->current, (const char*) text, text_len);
 }
 
+static void
+jabber_parser_structured_error_handler(void *user_data, xmlErrorPtr error)
+{
+	JabberStream *js = user_data;
+
+	purple_debug_error("jabber", "XML parser error for JabberStream %p: "
+								 "Domain %i, code %i, level %i: %s\n",
+					   js,
+					   error->domain, error->code, error->level,
+					   (error->message ? error->message : "(null)"));
+}
+
 static xmlSAXHandler jabber_parser_libxml = {
 	NULL,									/*internalSubset*/
 	NULL,									/*isStandalone*/
@@ -164,7 +176,7 @@
 	NULL,									/*_private*/
 	jabber_parser_element_start_libxml,		/*startElementNs*/
 	jabber_parser_element_end_libxml,		/*endElementNs*/
-	NULL									/*serror*/
+	jabber_parser_structured_error_handler	/*serror*/
 };
 
 void