1
0
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Autotidy windows on /leave

fixes #917
This commit is contained in:
James Booth 2017-03-21 21:10:38 +00:00
parent 1242fb7f71
commit f1a5d12950
2 changed files with 5 additions and 15 deletions

View File

@ -576,7 +576,7 @@ static struct cmd_t command_defs[] =
CMD_SYN(
"/leave")
CMD_DESC(
"Leave the current chat room.")
"Leave the current chat or room.")
CMD_NOARGS
CMD_NOEXAMPLES
},

View File

@ -4756,24 +4756,14 @@ cmd_clear(ProfWin *window, const char *const command, gchar **args)
gboolean
cmd_leave(ProfWin *window, const char *const command, gchar **args)
{
jabber_conn_status_t conn_status = connection_get_status();
int index = wins_get_current_num();
if (window->type != WIN_MUC) {
cons_show("You can only use the /leave command in a chat room.");
if (window->type != WIN_MUC && window->type != WIN_CHAT && window->type != WIN_PRIVATE) {
cons_show("The /leave command is only valid in chat, or chat room windows.");
cons_alert();
return TRUE;
}
// handle leaving rooms, or chat
if (conn_status == JABBER_CONNECTED) {
ui_close_connected_win(index);
}
// close the window
ui_close_win(index);
return TRUE;
// use /close behaviour
return cmd_close(window, "/leave", args);
}
gboolean