Mercurial > pidgin
diff libpurple/protocols/jabber/parser.c @ 25586:f424f26dd329
*** Plucked rev d34a1589 (darkrain42@pidgin.im):
Feed a fake </stream:stream> to the XMPP parser to silence warnings.
Upgrading to TLS and disconnecting should no longer emit
'Extra content at the end of the document'
References #8830.
*** Plucked rev ca9f6d5b (darkrain42@pidgin.im):
Add xmlnode and bonjour structured error handlers.
Various libraries may set global structured error handlers and libxml2
prefers those to a per-context normal error handler. This causes us to
break badly.
References #8830.
*** Plucked rev 34f4897e (darkrain42@pidgin.im):
xmlCtxtGetLastError may return NULL, especially with other misbehaving
libraries in our address space.
References #8136.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 29 Apr 2009 20:57:53 +0000 |
parents | b096f7fb6899 |
children | 01f1929d0936 |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/parser.c Wed Apr 29 19:39:11 2009 +0000 +++ b/libpurple/protocols/jabber/parser.c Wed Apr 29 20:57:53 2009 +0000 @@ -205,6 +205,12 @@ jabber_parser_free(js); } +void +jabber_parser_close_stream(JabberStream *js) +{ + xmlParseChunk(js->context, "</stream:stream>", 16 /* length */, 0); +} + void jabber_parser_free(JabberStream *js) { if (js->context) { xmlParseChunk(js->context, NULL,0,1); @@ -224,8 +230,17 @@ xmlParseChunk(js->context, "", 0, 0); } else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) { xmlError *err = xmlCtxtGetLastError(js->context); + /* + * libxml2 uses a global setting to determine whether or not to store + * warnings. Other libraries may set this, which causes err to be + * NULL. See #8136 for details. + */ + xmlErrorLevel level = XML_ERR_WARNING; - switch (err->level) { + if (err) + level = err->level; + + switch (level) { case XML_ERR_NONE: purple_debug_info("jabber", "xmlParseChunk returned info %i\n", ret); break;