mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Send <gone/> when closing chat window
This commit is contained in:
parent
3c82fb28c4
commit
baced85767
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
#include "chat_session.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "contact.h"
|
#include "contact.h"
|
||||||
@ -985,8 +986,21 @@ _cmd_tiny(const char * const inp, struct cmd_help_t help)
|
|||||||
static gboolean
|
static gboolean
|
||||||
_cmd_close(const char * const inp, struct cmd_help_t help)
|
_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);
|
cons_bad_command(inp);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
2
src/ui.h
2
src/ui.h
@ -83,7 +83,7 @@ void title_bar_set_typing(gboolean is_typing);
|
|||||||
void title_bar_draw(void);
|
void title_bar_draw(void);
|
||||||
|
|
||||||
// main window actions
|
// main window actions
|
||||||
int win_close_win(void);
|
void win_close_win(void);
|
||||||
int win_in_chat(void);
|
int win_in_chat(void);
|
||||||
char *win_get_recipient(void);
|
char *win_get_recipient(void);
|
||||||
void win_show_typing(const char * const from);
|
void win_show_typing(const char * const from);
|
||||||
|
@ -171,30 +171,22 @@ gui_resize(const int ch, const char * const input, const int size)
|
|||||||
dirty = TRUE;
|
dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
win_close_win(void)
|
win_close_win(void)
|
||||||
{
|
{
|
||||||
if (win_in_chat()) {
|
// reset the chat win to unused
|
||||||
// reset the chat win to unused
|
strcpy(_wins[_curr_prof_win].from, "");
|
||||||
strcpy(_wins[_curr_prof_win].from, "");
|
wclear(_wins[_curr_prof_win].win);
|
||||||
wclear(_wins[_curr_prof_win].win);
|
_wins[_curr_prof_win].history_shown = 0;
|
||||||
_wins[_curr_prof_win].history_shown = 0;
|
|
||||||
|
|
||||||
// set it as inactive in the status bar
|
// set it as inactive in the status bar
|
||||||
status_bar_inactive(_curr_prof_win);
|
status_bar_inactive(_curr_prof_win);
|
||||||
|
|
||||||
// go back to console window
|
// go back to console window
|
||||||
_curr_prof_win = 0;
|
_curr_prof_win = 0;
|
||||||
title_bar_title();
|
title_bar_title();
|
||||||
|
|
||||||
dirty = TRUE;
|
dirty = TRUE;
|
||||||
|
|
||||||
// success
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
// didn't close anything
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user