about summary refs log tree commit diff stats
path: root/src/xmpp/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmpp/connection.c')
-rw-r--r--src/xmpp/connection.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c
index c93cb35a..d73d73c5 100644
--- a/src/xmpp/connection.c
+++ b/src/xmpp/connection.c
@@ -81,7 +81,7 @@ void
 connection_init(void)
 {
     xmpp_initialize();
-    conn.conn_status = JABBER_STARTED;
+    conn.conn_status = JABBER_DISCONNECTED;
     conn.presence_message = NULL;
     conn.xmpp_conn = NULL;
     conn.xmpp_ctx = NULL;
@@ -174,6 +174,17 @@ connection_connect(const char *const fulljid, const char *const passwd, const ch
     return conn.conn_status;
 }
 
+void
+connection_disconnect(void)
+{
+    conn.conn_status = JABBER_DISCONNECTING;
+    xmpp_disconnect(conn.xmpp_conn);
+
+    while (conn.conn_status == JABBER_DISCONNECTING) {
+        session_process_events(10);
+    }
+}
+
 #ifdef HAVE_LIBMESODE
 TLSCertificate*
 connection_get_tls_peer_cert(void)