diff options
author | James Booth <boothj5@gmail.com> | 2017-03-21 21:10:38 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2017-03-21 21:13:44 +0000 |
commit | f1a5d12950301d762c3a2465c768676730229eab (patch) | |
tree | d604a599cd559deee4c2dc2d10f561443ddde7f5 /src/command | |
parent | 1242fb7f71e32426e09e9c1dcb61aa398fc41209 (diff) | |
download | profani-tty-f1a5d12950301d762c3a2465c768676730229eab.tar.gz |
Autotidy windows on /leave
fixes #917
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/cmd_defs.c | 2 | ||||
-rw-r--r-- | src/command/cmd_funcs.c | 18 |
2 files changed, 5 insertions, 15 deletions
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index 8f8ced09..d5eba7c8 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -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 }, diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 3df17079..b1db10d6 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -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 |