about summary refs log tree commit diff stats
path: root/src/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/command.c b/src/command.c
index 938142e4..361f53b4 100644
--- a/src/command.c
+++ b/src/command.c
@@ -577,21 +577,17 @@ _cmd_connect(const char * const inp, struct cmd_help_t help)
 static gboolean
 _cmd_disconnect(const char * const inp, struct cmd_help_t help)
 {
-    char *jid = strdup(jabber_get_jid());
-    gboolean wait_response = jabber_disconnect();
-
-    if (wait_response) {
-        while (jabber_get_connection_status() == JABBER_DISCONNECTING) {
-            jabber_process_events();
-        }
-        jabber_free_resources();
+    if (jabber_get_connection_status() == JABBER_CONNECTED) {
+        char *jid = strdup(jabber_get_jid());
+        jabber_disconnect();
+        contact_list_clear();
+        jabber_restart();
+        cons_show("%s logged out successfully.", jid);
+        free(jid);
+    } else {
+        cons_show("You are not currently connected.");
     }
 
-    contact_list_clear();
-    jabber_restart();
-    cons_show("%s logged out successfully.", jid);
-    free(jid);
-
     return TRUE;
 }