diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-08-26 20:04:58 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-08-26 20:04:58 +0200 |
commit | 4a95d78c45574b6678f1d7f2d89ee361977899c4 (patch) | |
tree | 24f4a02fbdcc8bf5c703f7134ebcde8ec7d59a08 /src/gui | |
parent | dd0c20f6b6e3c500fff7da78123f55bd871dc0fd (diff) | |
download | weechat-4a95d78c45574b6678f1d7f2d89ee361977899c4.zip |
core: add variable ${property} in evaluation of options weechat.buffer.* (issue #352)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/gui-buffer.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index a581c3359..b1f45c002 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -658,7 +658,7 @@ gui_buffer_apply_config_option_property (struct t_gui_buffer *buffer, { const char *pos; char *buffer_mask, *value; - struct t_hashtable *pointers; + struct t_hashtable *pointers, *extra_vars; pos = strrchr (option->name, '.'); if (!pos) @@ -675,16 +675,24 @@ gui_buffer_apply_config_option_property (struct t_gui_buffer *buffer, WEECHAT_HASHTABLE_STRING, WEECHAT_HASHTABLE_POINTER, NULL, NULL); - if (pointers) + extra_vars = hashtable_new ( + 32, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING, + NULL, NULL); + if (pointers && extra_vars) { hashtable_set (pointers, "buffer", buffer); - value = eval_expression (CONFIG_STRING(option), pointers, NULL, NULL); + hashtable_set (extra_vars, "property", pos + 1); + value = eval_expression (CONFIG_STRING(option), + pointers, extra_vars, NULL); if (value) { gui_buffer_set (buffer, pos + 1, value); free (value); } hashtable_free (pointers); + hashtable_free (extra_vars); } } |