Fix some bugs with stream errors.
This commit is contained in:
@@ -82,13 +82,17 @@ static int _handle_error(xmpp_conn_t * const conn,
|
|||||||
|
|
||||||
/* create stream error structure */
|
/* create stream error structure */
|
||||||
conn->stream_error = (xmpp_stream_error_t *)xmpp_alloc(conn->ctx, sizeof(xmpp_stream_error_t));
|
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) {
|
if (conn->stream_error) {
|
||||||
child = xmpp_stanza_get_children(stanza);
|
child = xmpp_stanza_get_children(stanza);
|
||||||
do {
|
do {
|
||||||
if (child && strcmp(xmpp_stanza_get_ns(child),
|
if (child && strcmp(xmpp_stanza_get_ns(child),
|
||||||
XMPP_NS_STREAMS) == 0) {
|
XMPP_NS_STREAMS_IETF) == 0) {
|
||||||
name = xmpp_stanza_get_name(child);
|
name = xmpp_stanza_get_name(child);
|
||||||
if (strcmp(name, "text")) {
|
if (strcmp(name, "text") == 0) {
|
||||||
if (conn->stream_error->text)
|
if (conn->stream_error->text)
|
||||||
xmpp_free(conn->ctx, conn->stream_error->text);
|
xmpp_free(conn->ctx, conn->stream_error->text);
|
||||||
conn->stream_error->text = xmpp_stanza_get_text(child);
|
conn->stream_error->text = xmpp_stanza_get_text(child);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ extern "C" {
|
|||||||
#define XMPP_NS_CLIENT "jabber:client"
|
#define XMPP_NS_CLIENT "jabber:client"
|
||||||
#define XMPP_NS_COMPONENT "jabber:component:accept"
|
#define XMPP_NS_COMPONENT "jabber:component:accept"
|
||||||
#define XMPP_NS_STREAMS "http://etherx.jabber.org/streams"
|
#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_TLS "urn:ietf:params:xml:ns:xmpp-tls"
|
||||||
#define XMPP_NS_SASL "urn:ietf:params:xml:ns:xmpp-sasl"
|
#define XMPP_NS_SASL "urn:ietf:params:xml:ns:xmpp-sasl"
|
||||||
#define XMPP_NS_BIND "urn:ietf:params:xml:ns:xmpp-bind"
|
#define XMPP_NS_BIND "urn:ietf:params:xml:ns:xmpp-bind"
|
||||||
|
|||||||
Reference in New Issue
Block a user