diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2004-12-31 15:59:58 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2004-12-31 15:59:58 +0000 |
commit | de5af8a3b107c276de0dd0ebd57bfadee694b003 (patch) | |
tree | b265362274aa5cbfe554b86e8e0223685c536b83 /src/common | |
parent | 37a2f80fae6c096e599532b194349dd1f2324026 (diff) | |
download | weechat-de5af8a3b107c276de0dd0ebd57bfadee694b003.zip |
Added /buffer close, new keys: Alt-S (switch to server buffer), Alt-X (switch to first channel of next server)
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/command.c | 32 | ||||
-rw-r--r-- | src/common/weeconfig.c | 1 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/common/command.c b/src/common/command.c index bcb7899fe..be9702132 100644 --- a/src/common/command.c +++ b/src/common/command.c @@ -47,6 +47,7 @@ t_weechat_command weechat_commands[] = N_("[action | number]"), N_("action: action to do:\n" " move move buffer in the list (may be relative, for example -1)\n" + " close close buffer (for channel: same as /part without part message)\n" " list list opened buffers (no parameter implies this list)\n" " notify set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n" "number: jump to buffer by number"), @@ -834,6 +835,7 @@ int weechat_cmd_buffer (int argc, char **argv) { t_gui_buffer *ptr_buffer; + t_irc_server *ptr_server; long number; char *error; @@ -916,6 +918,36 @@ weechat_cmd_buffer (int argc, char **argv) return -1; } } + else if (strcasecmp (argv[0], "close") == 0) + { + /* close buffer (server or channel/private) */ + + if ((!gui_current_window->buffer->next_buffer) + && (gui_current_window->buffer == gui_buffers)) + { + gui_printf (gui_current_window->buffer, + _("%s can not close the single buffer\n"), + WEECHAT_ERROR); + return -1; + } + if (BUFFER_IS_SERVER(gui_current_window->buffer)) + { + if (SERVER(gui_current_window->buffer)->channels) + { + gui_printf (gui_current_window->buffer, + _("%s can not close server buffer while channels " + "are opened\n"), + WEECHAT_ERROR); + return -1; + } + server_disconnect (SERVER(gui_current_window->buffer), 0); + ptr_server = SERVER(gui_current_window->buffer); + gui_buffer_free (gui_current_window->buffer, 1); + ptr_server->buffer = NULL; + } + else + irc_cmd_send_part (SERVER(gui_current_window->buffer), NULL); + } else if (strcasecmp (argv[0], "notify") == 0) { /* set notify level for buffer */ diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c index e3c0ca190..746ad44df 100644 --- a/src/common/weeconfig.c +++ b/src/common/weeconfig.c @@ -1189,6 +1189,7 @@ config_create_default () fprintf (file, "SIGNOFF=quit\n"); fprintf (file, "C=clear\n"); fprintf (file, "CL=clear\n"); + fprintf (file, "CLOSE=buffer close\n"); fprintf (file, "# CHAT=dcc chat\n"); fprintf (file, "# GET=dcc get\n"); fprintf (file, "# IG=ignore\n"); |