1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Remove _session_free_session_data from session.c

This commit is contained in:
James Booth 2016-05-10 22:49:58 +01:00
parent 02bc4f217c
commit 22c4d91c50
2 changed files with 44 additions and 39 deletions

View File

@ -77,7 +77,8 @@ TLSCertificate* _xmppcert_to_profcert(xmpp_tlscert_t *xmpptlscert);
static int _connection_certfail_cb(xmpp_tlscert_t *xmpptlscert, const char *const errormsg);
#endif
void connection_init(void)
void
connection_init(void)
{
xmpp_initialize();
conn.conn_status = JABBER_STARTED;

View File

@ -87,7 +87,6 @@ static void _session_reconnect(void);
static void _session_free_saved_account(void);
static void _session_free_saved_details(void);
static void _session_free_session_data(void);
void
session_init(void)
@ -218,8 +217,10 @@ session_disconnect(void)
}
_session_free_saved_account();
_session_free_saved_details();
_session_free_session_data();
connection_disco_items_free();
connection_remove_all_available_resources();
chat_sessions_clear();
presence_clear_sub_requests();
connection_free_conn();
connection_free_ctx();
}
@ -235,7 +236,10 @@ session_shutdown(void)
{
_session_free_saved_account();
_session_free_saved_details();
_session_free_session_data();
connection_disco_items_free();
connection_remove_all_available_resources();
chat_sessions_clear();
presence_clear_sub_requests();
xmpp_shutdown();
connection_free_log();
}
@ -327,14 +331,20 @@ session_login_failed(void)
sv_ev_failed_login();
_session_free_saved_account();
_session_free_saved_details();
_session_free_session_data();
connection_disco_items_free();
connection_remove_all_available_resources();
chat_sessions_clear();
presence_clear_sub_requests();
} else {
log_debug("Connection handler: Restarting reconnect timer");
if (prefs_get_reconnect() != 0) {
g_timer_start(reconnect_timer);
}
// free resources but leave saved_user untouched
_session_free_session_data();
connection_disco_items_free();
connection_remove_all_available_resources();
chat_sessions_clear();
presence_clear_sub_requests();
}
}
@ -349,7 +359,10 @@ session_lost_connection(void)
_session_free_saved_account();
_session_free_saved_details();
}
_session_free_session_data();
connection_disco_items_free();
connection_remove_all_available_resources();
chat_sessions_clear();
presence_clear_sub_requests();
}
static void
@ -357,16 +370,16 @@ _session_reconnect(void)
{
// reconnect with account.
ProfAccount *account = accounts_get_account(saved_account.name);
if (account == NULL) {
log_error("Unable to reconnect, account no longer exists: %s", saved_account.name);
} else {
return;
}
char *fulljid = create_fulljid(account->jid, account->resource);
log_debug("Attempting reconnect with account %s", account->name);
connection_connect(fulljid, saved_account.passwd, account->server, account->port, account->tls_policy);
free(fulljid);
g_timer_start(reconnect_timer);
}
}
static void
@ -386,12 +399,3 @@ _session_free_saved_details(void)
FREE_SET_NULL(saved_details.tls_policy);
}
static void
_session_free_session_data(void)
{
connection_disco_items_free();
connection_remove_all_available_resources();
chat_sessions_clear();
presence_clear_sub_requests();
}