From aa7fe0991f604a8ccee56ef8665645b1a6399d30 Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 9 Sep 2014 22:32:52 +0100 Subject: Added usages for stanza_get_error_message in iq.c --- src/xmpp/iq.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 8fcd8b7b..2224173e 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -208,15 +208,18 @@ _error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); + char *error_msg = stanza_get_error_message(stanza); if (id != NULL) { - log_debug("IQ error handler fired, id: %s.", id); - log_error("IQ error received, id: %s.", id); + log_debug("IQ error handler fired, id: %s, error: %s", id, error_msg); + log_error("IQ error received, id: %s, error: %s", id, error_msg); } else { - log_debug("IQ error handler fired."); - log_error("IQ error received."); + log_debug("IQ error handler fired, error: %s", error_msg); + log_error("IQ error received, error: %s", error_msg); } + free(error_msg); + return 1; } @@ -236,7 +239,9 @@ _pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, if (id != NULL && type != NULL) { // show warning if error if (strcmp(type, STANZA_TYPE_ERROR) == 0) { - log_warning("Server ping (id=%s) responded with error", id); + char *error_msg = stanza_get_error_message(stanza); + log_warning("Server ping (id=%s) responded with error: %s", id, error_msg); + free(error_msg); // turn off autoping if error type is 'cancel' xmpp_stanza_t *error = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_ERROR); -- cgit 1.4.1-2-gfad0