diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-03-19 18:24:39 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-03-19 18:24:39 +0100 |
commit | cee14f10d6597a891fbf683a033a9d7530e2a738 (patch) | |
tree | dc4328a55da2f4e107b9777d93373642ced082b1 /src | |
parent | e4f181beb3279eef22a58f8e79c57264321cbd5a (diff) | |
download | weechat-cee14f10d6597a891fbf683a033a9d7530e2a738.zip |
core: add option `rename` in command `/bar`
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-command.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index a79faefc0..5c5b95ac3 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -227,7 +227,7 @@ COMMAND_CALLBACK(bar) int i, type, position, number; long value; char *error, *str_type, *pos_condition, *name; - struct t_gui_bar *ptr_bar; + struct t_gui_bar *ptr_bar, *ptr_bar2; struct t_gui_bar_item *ptr_item; struct t_gui_window *ptr_window; @@ -394,6 +394,34 @@ COMMAND_CALLBACK(bar) return WEECHAT_RC_OK; } + /* rename a bar */ + if (string_strcmp (argv[1], "rename") == 0) + { + COMMAND_MIN_ARGS(4, "rename"); + ptr_bar = gui_bar_search (argv[2]); + if (!ptr_bar) + { + gui_chat_printf (NULL, + _("%sBar \"%s\" not found"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + argv[2]); + return WEECHAT_RC_OK; + } + ptr_bar2 = gui_bar_search (argv[3]); + if (ptr_bar2) + { + gui_chat_printf (NULL, + _("%sBar \"%s\" already exists for " + "\"%s\" command"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + argv[3], "bar rename"); + return WEECHAT_RC_OK; + } + gui_bar_set (ptr_bar, "name", argv[3]); + gui_chat_printf (NULL, _("Bar \"%s\" renamed to \"%s\""), argv[2], argv[3]); + return WEECHAT_RC_OK; + } + /* delete a bar */ if (string_strcmp (argv[1], "del") == 0) { @@ -7598,6 +7626,7 @@ command_init () " || add <name> <type>[,<conditions>] <position> <size> <separator> " "<item1>[,<item2>...]" " || default [input|title|status|nicklist]" + " || rename <name> <new_name>" " || del <name>|-all" " || set <name> <option> <value>" " || hide|show|toggle <name>" @@ -7625,6 +7654,7 @@ command_init () "(space between items) or \"+\" (glued items))\n" " default: create a default bar (all default bars if no bar " "name is given)\n" + " rename: rename a bar\n" " del: delete a bar (or all bars with -all)\n" " set: set a value for a bar property\n" " option: option to change (for options list, look at /set " @@ -7656,6 +7686,7 @@ command_init () " || listitems" " || add %(bars_names) root|window bottom|top|left|right" " || default input|title|status|nicklist|%*" + " || rename %(bars_names)" " || del %(bars_names)|-all" " || set %(bars_names) name|%(bars_options)" " || hide %(bars_names)" |