Mercurial > pidgin.yaz
diff libpurple/protocols/jabber/jabber.c @ 25871: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 | b90c26f391b0 |
children | 3b674151cd60 |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c Wed Apr 29 19:39:11 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Wed Apr 29 20:57:53 2009 +0000 @@ -77,6 +77,10 @@ "xmlns:stream='http://etherx.jabber.org/streams' " "version='1.0'>", js->user->domain); + if (js->reinit) + /* Close down the current stream to keep the XML parser happy */ + jabber_parser_close_stream(js); + /* setup the parser fresh for each stream */ jabber_parser_setup(js); jabber_send_raw(js, open_stream, -1); @@ -636,6 +640,9 @@ static void tls_init(JabberStream *js) { + /* Close down the current stream to keep the XML parser happy */ + jabber_parser_close_stream(js); + purple_input_remove(js->gc->inpa); js->gc->inpa = 0; js->gsc = purple_ssl_connect_with_host_fd(js->gc->account, js->fd, @@ -1327,6 +1334,16 @@ if (!gc->disconnect_timeout) jabber_send_raw(js, "</stream:stream>", -1); + if (!purple_account_get_current_error(purple_connection_get_account(gc))) { + /* + * The common case is user-triggered, so we never receive a + * </stream:stream> from the server when disconnecting, so silence the + * parser's warnings. On errors, though, the server terminated the + * connection, so we should have received a real </stream:stream>. + */ + jabber_parser_close_stream(js); + } + if (js->srv_query_data) purple_srv_cancel(js->srv_query_data);