diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index d58f95fd..13bda812 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -194,6 +194,16 @@ connection_disconnect(void) while (conn.conn_status == JABBER_DISCONNECTING) { session_process_events(10); } + + if (conn.xmpp_conn) { + xmpp_conn_release(conn.xmpp_conn); + conn.xmpp_conn = NULL; + } + + if (conn.xmpp_ctx) { + xmpp_ctx_free(conn.xmpp_ctx); + conn.xmpp_ctx = NULL; + } } #ifdef HAVE_LIBMESODE @@ -372,24 +382,6 @@ connection_get_presence_msg(void) return conn.presence_message; } -void -connection_free_conn(void) -{ - if (conn.xmpp_conn) { - xmpp_conn_release(conn.xmpp_conn); - conn.xmpp_conn = NULL; - } -} - -void -connection_free_ctx(void) -{ - if (conn.xmpp_ctx) { - xmpp_ctx_free(conn.xmpp_ctx); - conn.xmpp_ctx = NULL; - } -} - void connection_free_presence_msg(void) { diff --git a/src/xmpp/connection.h b/src/xmpp/connection.h index 422e7ad3..5f403ae0 100644 --- a/src/xmpp/connection.h +++ b/src/xmpp/connection.h @@ -50,8 +50,6 @@ void connection_set_priority(const int priority); void connection_set_priority(int priority); void connection_set_disco_items(GSList *items); -void connection_free_conn(void); -void connection_free_ctx(void); void connection_free_presence_msg(void); void connection_free_domain(void); diff --git a/src/xmpp/session.c b/src/xmpp/session.c index f2f50aef..73b443b7 100644 --- a/src/xmpp/session.c +++ b/src/xmpp/session.c @@ -116,8 +116,12 @@ session_connect_with_account(const ProfAccount *const account) // connect with fulljid Jid *jidp = jid_create_from_bare_and_resource(account->jid, account->resource); - jabber_conn_status_t result = - connection_connect(jidp->fulljid, account->password, account->server, account->port, account->tls_policy); + jabber_conn_status_t result = connection_connect( + jidp->fulljid, + account->password, + account->server, + account->port, + account->tls_policy); jid_destroy(jidp); return result; @@ -181,8 +185,6 @@ session_autoping_fail(void) plugins_on_disconnect(account_name, fulljid); accounts_set_last_activity(session_get_account_name()); connection_disconnect(); - connection_free_conn(); - connection_free_ctx(); } connection_free_presence_msg(); @@ -210,8 +212,6 @@ session_disconnect(void) connection_remove_all_available_resources(); chat_sessions_clear(); presence_clear_sub_requests(); - connection_free_conn(); - connection_free_ctx(); } connection_free_presence_msg();