about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-05-10 23:27:16 +0100
committerJames Booth <boothj5@gmail.com>2016-05-10 23:27:16 +0100
commita67d199581ca39c0cba84bab2ee421390fc71ec1 (patch)
tree4560f97f9ee22c85e558cbd7e5ff9504ee1b6805
parent3d20c85ada04c4dbd1552671d87ef1729d78a1c8 (diff)
downloadprofani-tty-a67d199581ca39c0cba84bab2ee421390fc71ec1.tar.gz
Add connection_shutdown()
-rw-r--r--src/xmpp/connection.c18
-rw-r--r--src/xmpp/connection.h2
-rw-r--r--src/xmpp/session.c5
3 files changed, 13 insertions, 12 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index d73d73c5..d58f95fd 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -90,6 +90,17 @@ connection_init(void)
     conn.available_resources = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)resource_destroy);
 }
 
+void
+connection_shutdown(void)
+{
+    connection_disco_items_free();
+    connection_remove_all_available_resources();
+    xmpp_shutdown();
+
+    free(conn.xmpp_log);
+    conn.xmpp_log = NULL;
+}
+
 jabber_conn_status_t
 connection_connect(const char *const fulljid, const char *const passwd, const char *const altdomain, int port,
     const char *const tls_policy)
@@ -401,13 +412,6 @@ connection_free_domain(void)
 }
 
 void
-connection_free_log(void)
-{
-    free(conn.xmpp_log);
-    conn.xmpp_log = NULL;
-}
-
-void
 connection_set_priority(const int priority)
 {
     conn.priority = priority;
diff --git a/src/xmpp/connection.h b/src/xmpp/connection.h
index b7148769..422e7ad3 100644
--- a/src/xmpp/connection.h
+++ b/src/xmpp/connection.h
@@ -38,6 +38,7 @@
 #include "xmpp/xmpp.h"
 
 void connection_init(void);
+void connection_shutdown(void);
 
 jabber_conn_status_t connection_connect(const char *const fulljid, const char *const passwd, const char *const altdomain, int port,
     const char *const tls_policy);
@@ -53,7 +54,6 @@ void connection_free_conn(void);
 void connection_free_ctx(void);
 void connection_free_presence_msg(void);
 void connection_free_domain(void);
-void connection_free_log(void);
 
 xmpp_conn_t* connection_get_conn(void);
 xmpp_ctx_t* connection_get_ctx(void);
diff --git a/src/xmpp/session.c b/src/xmpp/session.c
index 7be762a5..f2f50aef 100644
--- a/src/xmpp/session.c
+++ b/src/xmpp/session.c
@@ -225,12 +225,9 @@ session_shutdown(void)
 {
     _session_free_saved_account();
     _session_free_saved_details();
-    connection_disco_items_free();
-    connection_remove_all_available_resources();
     chat_sessions_clear();
     presence_clear_sub_requests();
-    xmpp_shutdown();
-    connection_free_log();
+    connection_shutdown();
 }
 
 void