Fix some bugs with stream errors.

This commit is contained in:
James Canete
2006-08-28 23:03:42 +00:00
parent fbb6a6b4c6
commit 9d25e25002
2 changed files with 7 additions and 2 deletions

View File

@@ -82,13 +82,17 @@ static int _handle_error(xmpp_conn_t * const conn,
/* create stream error structure */
conn->stream_error = (xmpp_stream_error_t *)xmpp_alloc(conn->ctx, sizeof(xmpp_stream_error_t));
conn->stream_error->text = NULL;
conn->stream_error->type = XMPP_SE_UNDEFINED_CONDITION;
if (conn->stream_error) {
child = xmpp_stanza_get_children(stanza);
do {
if (child && strcmp(xmpp_stanza_get_ns(child),
XMPP_NS_STREAMS) == 0) {
XMPP_NS_STREAMS_IETF) == 0) {
name = xmpp_stanza_get_name(child);
if (strcmp(name, "text")) {
if (strcmp(name, "text") == 0) {
if (conn->stream_error->text)
xmpp_free(conn->ctx, conn->stream_error->text);
conn->stream_error->text = xmpp_stanza_get_text(child);

View File

@@ -17,6 +17,7 @@ extern "C" {
#define XMPP_NS_CLIENT "jabber:client"
#define XMPP_NS_COMPONENT "jabber:component:accept"
#define XMPP_NS_STREAMS "http://etherx.jabber.org/streams"
#define XMPP_NS_STREAMS_IETF "urn:ietf:params:xml:ns:xmpp-streams"
#define XMPP_NS_TLS "urn:ietf:params:xml:ns:xmpp-tls"
#define XMPP_NS_SASL "urn:ietf:params:xml:ns:xmpp-sasl"
#define XMPP_NS_BIND "urn:ietf:params:xml:ns:xmpp-bind"