1
1
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( CMD_SYN(
"/leave") "/leave")
CMD_DESC( CMD_DESC(
"Leave the current chat room.") "Leave the current chat or room.")
CMD_NOARGS CMD_NOARGS
CMD_NOEXAMPLES CMD_NOEXAMPLES
}, },

View File

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