diff --git a/src/auth.c b/src/auth.c index f264a26..38c574f 100644 --- a/src/auth.c +++ b/src/auth.c @@ -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); diff --git a/strophe.h b/strophe.h index c04e02c..48392c3 100644 --- a/strophe.h +++ b/strophe.h @@ -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"