| 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 } |