Mercurial > pidgin
comparison libpurple/protocols/jabber/parser.c @ 23954: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 | 76dbcdd86fe2 |
children | e2f5a4a091b5 |
comparison
equal
deleted
inserted
replaced
23952:0525d448ee8c | 23954:08c50482d5a2 |
---|---|
205 /* libxml inconsistently starts parsing on creating the | 205 /* libxml inconsistently starts parsing on creating the |
206 * parser, so do a ParseChunk right afterwards to force it. */ | 206 * parser, so do a ParseChunk right afterwards to force it. */ |
207 js->context = xmlCreatePushParserCtxt(&jabber_parser_libxml, js, buf, len, NULL); | 207 js->context = xmlCreatePushParserCtxt(&jabber_parser_libxml, js, buf, len, NULL); |
208 xmlParseChunk(js->context, "", 0, 0); | 208 xmlParseChunk(js->context, "", 0, 0); |
209 } else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) { | 209 } else if ((ret = xmlParseChunk(js->context, buf, len, 0)) != XML_ERR_OK) { |
210 purple_debug_error("jabber", "xmlParseChunk returned error %i", ret); | 210 xmlError *err = xmlCtxtGetLastError(js->context); |
211 | 211 |
212 if ((ret >= XML_ERR_INVALID_HEX_CHARREF) && (ret <= XML_ERR_INVALID_CHAR)) { | 212 purple_debug_error("jabber", "xmlParseChunk returned error %i\n", ret); |
213 /* If the error involves an invalid character, just drop this message. | 213 |
214 * We'll create a new parser next time it's needed. */ | 214 if (err->level == XML_ERR_FATAL) { |
215 jabber_parser_free(js); | |
216 } else { | |
217 purple_connection_error_reason (js->gc, | 215 purple_connection_error_reason (js->gc, |
218 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | 216 PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
219 _("XML Parse error")); | 217 _("XML Parse error")); |
220 } | 218 } |
221 } | 219 } |