diff options
author | James Booth <boothj5@gmail.com> | 2014-04-23 20:51:57 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-04-23 20:51:57 +0100 |
commit | 4384a1f4688968bcf621ddcaae58438374cad29d (patch) | |
tree | 9e8f7548e9e47b3287ea329d9d12120c539680ed /src/xmpp | |
parent | 1706980fd798a3ef800adad5b59611019b69cbab (diff) | |
download | profani-tty-4384a1f4688968bcf621ddcaae58438374cad29d.tar.gz |
Tidied jabber_process_events
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/connection.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 785003e8..95c7fd82 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -205,22 +205,28 @@ _jabber_shutdown(void) static void _jabber_process_events(void) { - // run xmpp event loop if connected, connecting or disconnecting - if (jabber_conn.conn_status == JABBER_CONNECTED - || jabber_conn.conn_status == JABBER_CONNECTING - || jabber_conn.conn_status == JABBER_DISCONNECTING) { - xmpp_run_once(jabber_conn.ctx, 10); - - // check timer and reconnect if disconnected and timer set - } else if (prefs_get_reconnect() != 0) { - if ((jabber_conn.conn_status == JABBER_DISCONNECTED) && - (reconnect_timer != NULL)) { - if (g_timer_elapsed(reconnect_timer, NULL) > prefs_get_reconnect()) { - _jabber_reconnect(); + int reconnect_sec; + int elapsed_sec; + + switch (jabber_conn.conn_status) + { + case JABBER_CONNECTED: + case JABBER_CONNECTING: + case JABBER_DISCONNECTING: + xmpp_run_once(jabber_conn.ctx, 10); + break; + case JABBER_DISCONNECTED: + reconnect_sec = prefs_get_reconnect(); + if ((reconnect_sec != 0) && (reconnect_timer != NULL)) { + elapsed_sec = g_timer_elapsed(reconnect_timer, NULL); + if (elapsed_sec > reconnect_sec) { + _jabber_reconnect(); + } } - } + break; + default: + break; } - } static GList * |