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.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/command.c b/src/command.c
index f8c5b1e9..d4f1756d 100644
--- a/src/command.c
+++ b/src/command.c
@@ -25,6 +25,7 @@
 
 #include <glib.h>
 
+#include "chat_session.h"
 #include "command.h"
 #include "common.h"
 #include "contact.h"
@@ -985,8 +986,21 @@ _cmd_tiny(const char * const inp, struct cmd_help_t help)
 static gboolean
 _cmd_close(const char * const inp, struct cmd_help_t help)
 {
-    if (!win_close_win())
+    if (win_in_chat()) {
+        char *recipient = win_get_recipient();
+
+        // send <gone/> chat state before closing
+        if (chat_session_get_recipient_supports(recipient)) {
+            chat_session_gone(recipient);
+            jabber_send_gone(recipient);
+            chat_session_end(recipient);
+        }
+
+        win_close_win();
+
+    } else {
         cons_bad_command(inp);
+    }
 
     return TRUE;
 }