From 4a95d78c45574b6678f1d7f2d89ee361977899c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 26 Aug 2023 20:04:58 +0200 Subject: [PATCH] core: add variable ${property} in evaluation of options weechat.buffer.* (issue #352) --- po/cs.po | 5 +++-- po/de.po | 11 ++++++++--- po/es.po | 5 +++-- po/fr.po | 10 ++++++---- po/hu.po | 5 +++-- po/it.po | 5 +++-- po/ja.po | 5 +++-- po/pl.po | 5 +++-- po/pt.po | 5 +++-- po/pt_BR.po | 5 +++-- po/ru.po | 5 +++-- po/sr.po | 5 +++-- po/tr.po | 5 +++-- po/weechat.pot | 5 +++-- src/core/wee-config.c | 3 ++- src/gui/gui-buffer.c | 14 +++++++++++--- 16 files changed, 63 insertions(+), 35 deletions(-) diff --git a/po/cs.po b/po/cs.po index fa2bae872..fe322a61e 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" "PO-Revision-Date: 2023-06-26 21:34+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -3219,7 +3219,8 @@ msgstr "%sUpozornění: %s, řádek %d: neznámý identifikátor sekce (\"%s\")" #, c-format msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" #, fuzzy, c-format diff --git a/po/de.po b/po/de.po index 9994aafe0..570ad6b32 100644 --- a/po/de.po +++ b/po/de.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" "PO-Revision-Date: 2023-08-24 13:36+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -4177,10 +4177,15 @@ msgid "%sWarning: unknown option for section \"%s\": %s (value: \"%s\")" msgstr "" "%sWarnung: unbekannte Einstellung für Sektion \"%s\": %s (Wert: \"%s\")" -#, c-format +#, fuzzy, c-format +#| msgid "" +#| "set property \"%s\" on any buffer matching mask \"%s\"; content is " +#| "evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +#| "opened" msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" "Eigenschaft „%s“ bei jedem Buffer setzen, der mit der Maske „%s“ " "übereinstimmt; Inhalt istevaluiert, siehe /help eval; ${buffer} ist ein " diff --git a/po/es.po b/po/es.po index 1893e04a1..5843cc24c 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" "PO-Revision-Date: 2023-06-26 21:34+0200\n" "Last-Translator: Santiago Forero \n" "Language-Team: weechat-dev \n" @@ -3772,7 +3772,8 @@ msgstr "" #, c-format msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" #, fuzzy, c-format diff --git a/po/fr.po b/po/fr.po index 86c7121e9..84569d759 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" -"PO-Revision-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" +"PO-Revision-Date: 2023-08-26 20:04+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -4015,11 +4015,13 @@ msgstr "" #, c-format msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" "définir la propriété \"%s\" sur tout tampon correspondant au masque \"%s\" ; " "le contenu est évalue, voir /help eval ; ${buffer} est un pointeur vers le " -"tampon en cours d'ouverture" +"tampon en cours d'ouverture, ${property} est le nom de la propriété qui est " +"définie" #, c-format msgid "Option \"weechat.buffer.%s\" has been set to \"%s\"" diff --git a/po/hu.po b/po/hu.po index e780ab22d..f54795be0 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -2861,7 +2861,8 @@ msgstr "%s %s, %d. sor: ismeretlen csoportazonosító (\"%s\")\n" #, c-format msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" #, fuzzy, c-format diff --git a/po/it.po b/po/it.po index 68df303a1..88895c8f3 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" "PO-Revision-Date: 2023-06-26 21:34+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -3383,7 +3383,8 @@ msgstr "" #, c-format msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" #, fuzzy, c-format diff --git a/po/ja.po b/po/ja.po index cc0b41692..174841325 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" "PO-Revision-Date: 2023-08-08 07:13+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language-Team: Polish \n" @@ -4497,7 +4497,8 @@ msgstr "%sOstrzeżenie: nieznana opcja dla sekcji \"%s\": %s (wartość: \"%s\") #, c-format msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" #, fuzzy, c-format diff --git a/po/pt.po b/po/pt.po index 426861e4b..35a7a2d22 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" "PO-Revision-Date: 2023-06-26 21:34+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -3937,7 +3937,8 @@ msgstr "%sAviso: opção desconhecida na secção \"%s\": %s (valor: \"%s\")" #, c-format msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" #, fuzzy, c-format diff --git a/po/pt_BR.po b/po/pt_BR.po index 61ee654bf..b43182668 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" "PO-Revision-Date: 2023-06-26 21:34+0200\n" "Last-Translator: Érico Nogueira \n" "Language-Team: weechat-dev \n" @@ -3469,7 +3469,8 @@ msgstr "%sAviso: opção desconhecida para seção \"%s\": %s (valor: \"%s\")" #, c-format msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" #, fuzzy, c-format diff --git a/po/ru.po b/po/ru.po index 66c061d60..646d3e6b9 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" "PO-Revision-Date: 2023-06-17 11:47+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -2885,7 +2885,8 @@ msgstr "%s %s, строка %d: неизвестный идентификато #, c-format msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" #, fuzzy, c-format diff --git a/po/sr.po b/po/sr.po index f59f55c8c..72133391a 100644 --- a/po/sr.po +++ b/po/sr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" "PO-Revision-Date: 2023-08-08 07:14+0200\n" "Last-Translator: Ivan Pešić \n" "Language-Team: weechat-dev \n" @@ -4105,7 +4105,8 @@ msgstr "%sУпозорење: непозната опција за одељак #, c-format msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" #, fuzzy, c-format diff --git a/po/tr.po b/po/tr.po index 157f05a08..94f517451 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" "PO-Revision-Date: 2023-08-08 07:14+0200\n" "Last-Translator: Emir SARI \n" "Language-Team: weechat-dev \n" @@ -4092,7 +4092,8 @@ msgstr "%sUyarı: \"%s\" bölümü için geçersiz seçenek: %s (değer: \"%s\"" #, c-format msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" #, fuzzy, c-format diff --git a/po/weechat.pot b/po/weechat.pot index df50bbc6a..075246389 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-08-26 15:27+0200\n" +"POT-Creation-Date: 2023-08-26 20:02+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -2630,7 +2630,8 @@ msgstr "" #, c-format msgid "" "set property \"%s\" on any buffer matching mask \"%s\"; content is " -"evaluated, see /help eval; ${buffer} is a pointer to the buffer being opened" +"evaluated, see /help eval; ${buffer} is a pointer to the buffer being " +"opened, ${property} is the name of the property being set" msgstr "" #, c-format diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 1ab9a7195..980b7891b 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -2563,7 +2563,8 @@ config_weechat_buffer_create_option_cb (const void *pointer, void *data, "mask \"%s\"; " "content is evaluated, see /help eval; " "${buffer} is a pointer to the buffer being " - "opened"), + "opened, ${property} is the name of the property " + "being set"), pos + 1, buffer_mask); ptr_option = config_file_new_option ( 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); } }