diff options
author | Steffen Jaeckel <jaeckel-floss@eyet-services.de> | 2022-01-27 15:48:57 +0100 |
---|---|---|
committer | Steffen Jaeckel <jaeckel-floss@eyet-services.de> | 2022-02-01 15:01:28 +0100 |
commit | 20a8ef7a3e2d2d3e2dc505c93182582b6c74800b (patch) | |
tree | 66834af7892780b1f51d9bd875a517dfab9692df | |
parent | e31e2877fc5a0d910cf803ca547847be9d0f5ac6 (diff) | |
download | profani-tty-20a8ef7a3e2d2d3e2dc505c93182582b6c74800b.tar.gz |
session: combine internal free-functions
`_session_free_saved_details()` remains as it's still required alone Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
-rw-r--r-- | src/xmpp/session.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/xmpp/session.c b/src/xmpp/session.c index 4a19e211..fabf9f06 100644 --- a/src/xmpp/session.c +++ b/src/xmpp/session.c @@ -98,7 +98,7 @@ static char* saved_status; static void _session_reconnect(void); -static void _session_free_saved_account(void); +static void _session_free_internals(void); static void _session_free_saved_details(void); void @@ -117,8 +117,7 @@ session_connect_with_account(const ProfAccount* const account) log_info("Connecting using account: %s", account->name); - _session_free_saved_account(); - _session_free_saved_details(); + _session_free_internals(); // save account name and password for reconnect saved_account.name = strdup(account->name); @@ -152,8 +151,7 @@ session_connect_with_details(const char* const jid, const char* const passwd, co assert(jid != NULL); assert(passwd != NULL); - _session_free_saved_account(); - _session_free_saved_details(); + _session_free_internals(); // save details for reconnect, remember name for account creating on success saved_details.name = strdup(jid); @@ -240,8 +238,7 @@ session_disconnect(void) void session_shutdown(void) { - _session_free_saved_account(); - _session_free_saved_details(); + _session_free_internals(); chat_sessions_clear(); presence_clear_sub_requests(); @@ -371,8 +368,7 @@ session_login_failed(void) if (reconnect_timer == NULL) { log_debug("Connection handler: No reconnect timer"); sv_ev_failed_login(); - _session_free_saved_account(); - _session_free_saved_details(); + _session_free_internals(); } else { log_debug("Connection handler: Restarting reconnect timer"); if (prefs_get_reconnect() != 0) { @@ -394,8 +390,7 @@ session_lost_connection(void) assert(reconnect_timer == NULL); reconnect_timer = g_timer_new(); } else { - _session_free_saved_account(); - _session_free_saved_details(); + _session_free_internals(); } } @@ -562,10 +557,11 @@ _session_reconnect(void) } static void -_session_free_saved_account(void) +_session_free_internals(void) { FREE_SET_NULL(saved_account.name); FREE_SET_NULL(saved_account.passwd); + _session_free_saved_details(); } static void |