1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-29 19:56:07 -04:00

Added debug to connection handler

This commit is contained in:
James Booth 2013-02-26 22:02:03 +00:00
parent 236895ec96
commit d0e0951943

View File

@ -400,13 +400,16 @@ _connection_handler(xmpp_conn_t * const conn,
// login success // login success
if (status == XMPP_CONN_CONNECT) { if (status == XMPP_CONN_CONNECT) {
log_debug("Connection handler: XMPP_CONN_CONNECT");
// logged in with account // logged in with account
if (saved_account.name != NULL) { if (saved_account.name != NULL) {
log_debug("Connection handler: logged in with account name: %s", saved_account.name);
prof_handle_login_account_success(saved_account.name); prof_handle_login_account_success(saved_account.name);
// logged in without account, use details to create new account // logged in without account, use details to create new account
} else { } else {
log_debug("Connection handler: logged in with jid: %s", saved_details.name);
accounts_add(saved_details.name, saved_details.altdomain); accounts_add(saved_details.name, saved_details.altdomain);
accounts_set_jid(saved_details.name, saved_details.jid); accounts_set_jid(saved_details.name, saved_details.jid);
@ -442,9 +445,11 @@ _connection_handler(xmpp_conn_t * const conn,
} }
} else if (status == XMPP_CONN_DISCONNECT) { } else if (status == XMPP_CONN_DISCONNECT) {
log_debug("Connection handler: XMPP_CONN_DISCONNECT");
// lost connection for unkown reason // lost connection for unkown reason
if (jabber_conn.conn_status == JABBER_CONNECTED) { if (jabber_conn.conn_status == JABBER_CONNECTED) {
log_debug("Connection handler: Lost connection for unknown reason");
prof_handle_lost_connection(); prof_handle_lost_connection();
if (prefs_get_reconnect() != 0) { if (prefs_get_reconnect() != 0) {
assert(reconnect_timer == NULL); assert(reconnect_timer == NULL);
@ -456,10 +461,13 @@ _connection_handler(xmpp_conn_t * const conn,
// login attempt failed // login attempt failed
} else if (jabber_conn.conn_status != JABBER_DISCONNECTING) { } else if (jabber_conn.conn_status != JABBER_DISCONNECTING) {
log_debug("Connection handler: Login failed");
if (reconnect_timer == NULL) { if (reconnect_timer == NULL) {
log_debug("Connection handler: No reconnect timer");
prof_handle_failed_login(); prof_handle_failed_login();
connection_free_resources(); connection_free_resources();
} else { } else {
log_debug("Connection handler: Restarting reconnect timer");
if (prefs_get_reconnect() != 0) { if (prefs_get_reconnect() != 0) {
g_timer_start(reconnect_timer); g_timer_start(reconnect_timer);
} }
@ -469,6 +477,10 @@ _connection_handler(xmpp_conn_t * const conn,
// close stream response from server after disconnect is handled too // close stream response from server after disconnect is handled too
jabber_conn.conn_status = JABBER_DISCONNECTED; jabber_conn.conn_status = JABBER_DISCONNECTED;
} else if (status == XMPP_CONN_FAIL) {
log_debug("Connection handler: XMPP_CONN_FAIL");
} else {
log_error("Connection handler: Unknown status");
} }
} }