1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Tidied jabber_process_events

This commit is contained in:
James Booth 2014-04-23 20:51:57 +01:00
parent 1706980fd7
commit 4384a1f468

View File

@ -205,22 +205,28 @@ _jabber_shutdown(void)
static void static void
_jabber_process_events(void) _jabber_process_events(void)
{ {
// run xmpp event loop if connected, connecting or disconnecting int reconnect_sec;
if (jabber_conn.conn_status == JABBER_CONNECTED int elapsed_sec;
|| 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 switch (jabber_conn.conn_status)
} else if (prefs_get_reconnect() != 0) { {
if ((jabber_conn.conn_status == JABBER_DISCONNECTED) && case JABBER_CONNECTED:
(reconnect_timer != NULL)) { case JABBER_CONNECTING:
if (g_timer_elapsed(reconnect_timer, NULL) > prefs_get_reconnect()) { case JABBER_DISCONNECTING:
_jabber_reconnect(); 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 * static GList *