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

added resources release to connetion handler

This commit is contained in:
Dmitry Podgorny 2013-01-07 22:13:24 +02:00
parent 5542752afb
commit 0f0e04603a
2 changed files with 8 additions and 2 deletions

View File

@ -63,6 +63,7 @@ chat_sessions_init(void)
void void
chat_sessions_clear(void) chat_sessions_clear(void)
{ {
if (sessions != NULL)
g_hash_table_remove_all(sessions); g_hash_table_remove_all(sessions);
} }

View File

@ -527,6 +527,7 @@ jabber_free_resources(void)
FREE_SET_NULL(saved_account); FREE_SET_NULL(saved_account);
FREE_SET_NULL(saved_altdomain); FREE_SET_NULL(saved_altdomain);
chat_sessions_clear(); chat_sessions_clear();
if (sub_requests != NULL)
g_hash_table_remove_all(sub_requests); g_hash_table_remove_all(sub_requests);
xmpp_conn_release(jabber_conn.conn); xmpp_conn_release(jabber_conn.conn);
xmpp_ctx_free(jabber_conn.ctx); xmpp_ctx_free(jabber_conn.ctx);
@ -790,6 +791,9 @@ _connection_handler(xmpp_conn_t * const conn,
if (prefs_get_reconnect() != 0) { if (prefs_get_reconnect() != 0) {
assert(reconnect_timer == NULL); assert(reconnect_timer == NULL);
reconnect_timer = g_timer_new(); reconnect_timer = g_timer_new();
// TODO: free resources but leave saved_* untouched
} else {
jabber_free_resources();
} }
// login attempt failed // login attempt failed
@ -801,6 +805,7 @@ _connection_handler(xmpp_conn_t * const conn,
if (prefs_get_reconnect() != 0) { if (prefs_get_reconnect() != 0) {
g_timer_start(reconnect_timer); g_timer_start(reconnect_timer);
} }
// TODO: free resources but leave saved_* untouched
} }
} }