about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-05-10 23:34:25 +0100
committerJames Booth <boothj5@gmail.com>2016-05-10 23:34:25 +0100
commita7fa27df01057e31e1227213b4d0a6e275887ce0 (patch)
tree5777b133549c67034f7ad871a710c8794079bba9
parenta67d199581ca39c0cba84bab2ee421390fc71ec1 (diff)
downloadprofani-tty-a7fa27df01057e31e1227213b4d0a6e275887ce0.tar.gz
Remove connection_free_conn(), connection_free_ctx()
-rw-r--r--src/xmpp/connection.c28
-rw-r--r--src/xmpp/connection.h2
-rw-r--r--src/xmpp/session.c12
3 files changed, 16 insertions, 26 deletions
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
@@ -373,24 +383,6 @@ connection_get_presence_msg(void)
 }
 
 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)
 {
     FREE_SET_NULL(conn.presence_message);
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();