Send <gone/> when closing chat window

This commit is contained in:
James Booth
2012-10-31 21:30:58 +00:00
parent 3c82fb28c4
commit baced85767
3 changed files with 27 additions and 21 deletions

View File

@@ -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;
}