diff --git a/CHANGELOG.md b/CHANGELOG.md index 540ea5591..b2b266202 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - relay: add option relay.network.websocket_permessage_deflate ([#1549](https://github.com/weechat/weechat/issues/1549)) - relay: add option relay.look.raw_messages_max_length ([#2122](https://github.com/weechat/weechat/issues/2122)) - relay: add infos "relay_api_version" and "relay_api_version_number" +- script: add info "script_info" - core: add hdata count in evaluation of expressions with `hdata_count:name[list]` or `hdata_count:name[pointer]` - core: add info "window" ([#2141](https://github.com/weechat/weechat/issues/2141)) - core: add completion "bars_items" diff --git a/po/cs.po b/po/cs.po index b14b78849..21b448400 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: 2024-07-13 10:31+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" "PO-Revision-Date: 2024-06-11 07:49+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -15578,6 +15578,15 @@ msgstr "načteny %s skripty:" msgid "script name with extension" msgstr "seznam skriptů" +#, fuzzy +#| msgid "list of scripts" +msgid "info on a script" +msgstr "seznam skriptů" + +#, fuzzy +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "jméno serveru (zástupný znak \"*\" je povolen) (volitelné)" + #, fuzzy msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "jméno serveru (zástupný znak \"*\" je povolen) (volitelné)" diff --git a/po/de.po b/po/de.po index bc6d5f53c..6b4bf579f 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: 2024-07-13 10:31+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" "PO-Revision-Date: 2024-07-08 10:45+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -17069,6 +17069,18 @@ msgstr "1 falls Skript geladen wurde" msgid "script name with extension" msgstr "Skriptname mit Erweiterung" +#, fuzzy +#| msgid "list of scripts" +msgid "info on a script" +msgstr "Liste der Skripten" + +#, fuzzy +#| msgid "script name with extension (wildcard \"*\" is allowed) (optional)" +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "" +"Name des Skriptes, mit Dateierweiterung (Platzhalter \"*\" kann verwendet " +"werden) (optional)" + msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "" "Name des Skriptes, mit Dateierweiterung (Platzhalter \"*\" kann verwendet " diff --git a/po/es.po b/po/es.po index a9d59a6a0..692b9b39a 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: 2024-07-13 10:31+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" "PO-Revision-Date: 2024-06-11 07:49+0200\n" "Last-Translator: Santiago Forero \n" "Language-Team: weechat-dev \n" @@ -15875,6 +15875,17 @@ msgstr "scripts en %s cargados:" msgid "script name with extension" msgstr "lista de scripts" +#, fuzzy +#| msgid "list of scripts" +msgid "info on a script" +msgstr "lista de scripts" + +#, fuzzy +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "" +"nombre del script con extensión (puede empezar o terminar con \"*\" como " +"comodín) (opcional)" + #, fuzzy msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "" diff --git a/po/fr.po b/po/fr.po index b919ad51b..7265e8468 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: 2024-07-13 10:31+0200\n" -"PO-Revision-Date: 2024-07-13 10:32+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" +"PO-Revision-Date: 2024-07-17 22:33+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -16725,6 +16725,13 @@ msgstr "1 si le script est chargé" msgid "script name with extension" msgstr "nom du script avec l'extension" +msgid "info on a script" +msgstr "info sur un script" + +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "" +"script,info (nom du script avec extension et info est une variable hdata)" + msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "" "nom du script avec extension (le caractère joker \"*\" est autorisé) " diff --git a/po/hu.po b/po/hu.po index b74163936..e45d3fdca 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: 2024-07-13 10:31+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" "PO-Revision-Date: 2024-06-11 07:49+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -14887,6 +14887,13 @@ msgstr "FIFO cső bezárva\n" msgid "script name with extension" msgstr "Aliaszok listája:\n" +#, fuzzy +msgid "info on a script" +msgstr "Aliaszok listája:\n" + +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "" + msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "" diff --git a/po/it.po b/po/it.po index be09bee88..f6456229b 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: 2024-07-13 10:31+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" "PO-Revision-Date: 2024-06-11 07:49+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -15944,6 +15944,17 @@ msgstr "script %s caricati:" msgid "script name with extension" msgstr "elenco degli script" +#, fuzzy +#| msgid "list of scripts" +msgid "info on a script" +msgstr "elenco degli script" + +#, fuzzy +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "" +"nome script con l'estensione (può iniziare o terminare con \"*\" come " +"carattere jolly) (opzionale)" + #, fuzzy msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "" diff --git a/po/ja.po b/po/ja.po index 130e651a2..ee7dc2850 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: 2024-07-13 10:31+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" "PO-Revision-Date: 2024-06-11 07:49+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language-Team: weechat-dev \n" @@ -16288,6 +16288,17 @@ msgstr "1 jeśli skrypt jest załadowany" msgid "script name with extension" msgstr "nazwa skryptu z rozszerzeniem" +#, fuzzy +#| msgid "list of scripts" +msgid "info on a script" +msgstr "lista skryptów" + +#, fuzzy +#| msgid "script name with extension (wildcard \"*\" is allowed) (optional)" +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "" +"nazwa skryptu z rozszerzeniem (wildcard \"*\" jest dozwolony) (opcjonalne)\"" + msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "" "nazwa skryptu z rozszerzeniem (wildcard \"*\" jest dozwolony) (opcjonalne)\"" diff --git a/po/pt.po b/po/pt.po index edf2ea596..105ea0521 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: 2024-07-13 10:31+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" "PO-Revision-Date: 2024-06-11 07:49+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -16332,6 +16332,18 @@ msgstr "scripts %s carregados:" msgid "script name with extension" msgstr "lista de extensões de script" +#, fuzzy +#| msgid "list of scripts" +msgid "info on a script" +msgstr "lista de scripts" + +#, fuzzy +#| msgid "script name with extension (wildcard \"*\" is allowed) (optional)" +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "" +"nome do script com extensão (o caráter universal \"*\" é permitido) " +"(opcional)" + msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "" "nome do script com extensão (o caráter universal \"*\" é permitido) " diff --git a/po/pt_BR.po b/po/pt_BR.po index 594425d2e..861ea1d45 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: 2024-07-13 10:31+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" "PO-Revision-Date: 2024-06-11 07:49+0200\n" "Last-Translator: Érico Nogueira \n" "Language-Team: weechat-dev \n" @@ -15394,6 +15394,17 @@ msgstr "scripts %s carregados:" msgid "script name with extension" msgstr "list de scripts" +#, fuzzy +#| msgid "list of scripts" +msgid "info on a script" +msgstr "list de scripts" + +#, fuzzy +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "" +"nome do script (pode começar ou terminar com \"*\" como um coringa) " +"(opcional)" + #, fuzzy msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "" diff --git a/po/ru.po b/po/ru.po index 60bf8bcef..c82bb65d8 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: 2024-07-13 10:31+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" "PO-Revision-Date: 2024-06-11 07:49+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -14941,6 +14941,13 @@ msgstr "FIFO pipe закрыт\n" msgid "script name with extension" msgstr "Список сокращений:\n" +#, fuzzy +msgid "info on a script" +msgstr "Список сокращений:\n" + +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "" + msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "" diff --git a/po/sr.po b/po/sr.po index abf95e42a..7b74c5916 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: 2024-07-13 10:31+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" "PO-Revision-Date: 2024-07-10 11:29+0400\n" "Last-Translator: Ivan Pešić \n" "Language-Team: weechat-dev \n" @@ -16251,6 +16251,16 @@ msgstr "1 ако је скрипта учитана" msgid "script name with extension" msgstr "име скрипте са екстензијом" +#, fuzzy +#| msgid "list of scripts" +msgid "info on a script" +msgstr "листа скрипти" + +#, fuzzy +#| msgid "script name with extension (wildcard \"*\" is allowed) (optional)" +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "име скрипте са екстензијом (дозвољен је џокер „*”) (није обавезно)" + msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "име скрипте са екстензијом (дозвољен је џокер „*”) (није обавезно)" diff --git a/po/tr.po b/po/tr.po index aed4c820a..0de894125 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: 2024-07-13 10:31+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" "PO-Revision-Date: 2024-06-11 07:49+0200\n" "Last-Translator: Emir SARI \n" "Language-Team: weechat-dev \n" @@ -16674,6 +16674,16 @@ msgstr "Hiçbir betik yüklenmedi" msgid "script name with extension" msgstr "betik uzantılarının listesi" +#, fuzzy +#| msgid "list of scripts" +msgid "info on a script" +msgstr "betiklerin listesi" + +#, fuzzy +#| msgid "script name with extension (wildcard \"*\" is allowed) (optional)" +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "betik adı, uzantı ile (\"*\" jokerine izin verilir) (isteğe bağlı)" + msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "betik adı, uzantı ile (\"*\" jokerine izin verilir) (isteğe bağlı)" diff --git a/po/weechat.pot b/po/weechat.pot index f92353b86..c8b4849d3 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: 2024-07-13 10:31+0200\n" +"POT-Creation-Date: 2024-07-17 22:20+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -13629,6 +13629,12 @@ msgstr "" msgid "script name with extension" msgstr "" +msgid "info on a script" +msgstr "" + +msgid "script,info (script name with extension and info is a hdata variable" +msgstr "" + msgid "script name with extension (wildcard \"*\" is allowed) (optional)" msgstr "" diff --git a/src/plugins/script/script-info.c b/src/plugins/script/script-info.c index 2d565632a..55111983f 100644 --- a/src/plugins/script/script-info.c +++ b/src/plugins/script/script-info.c @@ -28,6 +28,84 @@ #include "script-repo.h" +/* + * Returns script info "script_info". + */ + +char * +script_info_info_script_info_cb (const void *pointer, void *data, + const char *info_name, + const char *arguments) +{ + int i, length; + char *script_name, hdata_name[128], *str_to_eval, *info; + const char *ptr_info, *ptr_name; + struct t_hdata *hdata; + struct t_hashtable *pointers; + void *ptr_script; + + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) info_name; + + if (!arguments || !arguments[0]) + return NULL; + + ptr_info = strchr (arguments, ','); + if (!ptr_info) + return NULL; + + info = NULL; + + script_name = weechat_strndup (arguments, ptr_info - arguments); + if (!script_name) + goto end; + + ptr_info++; + + for (i = 0; i < SCRIPT_NUM_LANGUAGES; i++) + { + snprintf (hdata_name, sizeof (hdata_name), + "%s_script", script_language[i]); + hdata = weechat_hdata_get (hdata_name); + ptr_script = weechat_hdata_get_list (hdata, "scripts"); + while (ptr_script) + { + ptr_name = weechat_hdata_string (hdata, ptr_script, "name"); + if (ptr_name) + { + length = strlen (ptr_name); + if ((strncmp (script_name, ptr_name, length) == 0) + && (script_name[length] == '.') + && (strcmp (script_name + length + 1, script_extension[i]) == 0)) + { + pointers = weechat_hashtable_new ( + 32, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_POINTER, + NULL, + NULL); + weechat_hashtable_set (pointers, hdata_name, ptr_script); + if (weechat_asprintf (&str_to_eval, "${%s.%s}", hdata_name, ptr_info) >= 0) + { + info = weechat_string_eval_expression ( + str_to_eval, pointers, NULL, NULL); + free (str_to_eval); + } + weechat_hashtable_free (pointers); + goto end; + } + } + ptr_script = weechat_hdata_move (hdata, ptr_script, 1); + } + } + +end: + free (script_name); + return info; +} + /* * Returns script info "script_loaded". */ @@ -145,6 +223,11 @@ void script_info_init () { /* info hooks */ + weechat_hook_info ( + "script_info", + N_("info on a script"), + N_("script,info (script name with extension and info is a hdata variable"), + &script_info_info_script_info_cb, NULL, NULL); weechat_hook_info ( "script_loaded", N_("1 if script is loaded"),