Moved connection_error_handler to _presence_error_handler
This commit is contained in:
@@ -322,49 +322,6 @@ _connection_free_session_data(void)
|
||||
presence_clear_sub_requests();
|
||||
}
|
||||
|
||||
int
|
||||
connection_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
void * const userdata)
|
||||
{
|
||||
xmpp_ctx_t *ctx = connection_get_ctx();
|
||||
gchar *err_msg = NULL;
|
||||
gchar *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
||||
xmpp_stanza_t *error_stanza = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_ERROR);
|
||||
xmpp_stanza_t *text_stanza = xmpp_stanza_get_child_by_name(error_stanza, STANZA_NAME_TEXT);
|
||||
|
||||
if (error_stanza == NULL) {
|
||||
log_debug("error message without <error/> received");
|
||||
} else {
|
||||
|
||||
// check for text
|
||||
if (text_stanza != NULL) {
|
||||
err_msg = xmpp_stanza_get_text(text_stanza);
|
||||
if (err_msg != NULL) {
|
||||
handle_error_message(from, err_msg);
|
||||
xmpp_free(ctx, err_msg);
|
||||
}
|
||||
|
||||
// TODO : process 'type' attribute from <error/> [RFC6120, 8.3.2]
|
||||
|
||||
// otherwise show defined-condition
|
||||
} else {
|
||||
xmpp_stanza_t *err_cond = xmpp_stanza_get_children(error_stanza);
|
||||
|
||||
if (err_cond == NULL) {
|
||||
log_debug("error message without <defined-condition/> or <text/> received");
|
||||
|
||||
} else {
|
||||
err_msg = xmpp_stanza_get_name(err_cond);
|
||||
handle_error_message(from, err_msg);
|
||||
|
||||
// TODO : process 'type' attribute from <error/> [RFC6120, 8.3.2]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static jabber_conn_status_t
|
||||
_jabber_connect(const char * const fulljid, const char * const passwd,
|
||||
const char * const altdomain, int port)
|
||||
|
||||
Reference in New Issue
Block a user