diff --git a/doc/de/weechat_user.de.adoc b/doc/de/weechat_user.de.adoc index 85c1a22d2..95428df21 100644 --- a/doc/de/weechat_user.de.adoc +++ b/doc/de/weechat_user.de.adoc @@ -2283,6 +2283,19 @@ Reserved names (built-in theme names like `+light+` and any name starting with `+backup-+`) are refused. Files live at `+${weechat_config_dir}/themes/.theme+`. +Rename a user theme (typical use: keep a useful automatic backup +under a meaningful name): + +---- +/theme rename backup-20260525-094210-123456 mybackup +---- + +Built-in themes have no file and cannot be renamed; the target name +cannot match a built-in name or start with `+backup-+`, and the +target file must not already exist. The `+[info]+` `+name+` field +inside the file is rewritten so `/theme info` reports the new name +consistently. + Delete a user theme: ---- diff --git a/doc/en/weechat_user.en.adoc b/doc/en/weechat_user.en.adoc index 901c60541..7335b6671 100644 --- a/doc/en/weechat_user.en.adoc +++ b/doc/en/weechat_user.en.adoc @@ -2270,6 +2270,19 @@ Reserved names (built-in theme names like `+light+` and any name starting with `+backup-+`) are refused. Files live at `+${weechat_config_dir}/themes/.theme+`. +Rename a user theme (typical use: keep a useful automatic backup +under a meaningful name): + +---- +/theme rename backup-20260525-094210-123456 mybackup +---- + +Built-in themes have no file and cannot be renamed; the target name +cannot match a built-in name or start with `+backup-+`, and the +target file must not already exist. The `+[info]+` `+name+` field +inside the file is rewritten so `/theme info` reports the new name +consistently. + Delete a user theme: ---- diff --git a/doc/fr/weechat_user.fr.adoc b/doc/fr/weechat_user.fr.adoc index b15a50eef..2fc46167d 100644 --- a/doc/fr/weechat_user.fr.adoc +++ b/doc/fr/weechat_user.fr.adoc @@ -2319,6 +2319,20 @@ Les noms réservés (noms de thèmes intégrés comme `+light+` et tout nom commençant par `+backup-+`) sont refusés. Les fichiers sont placés dans `+${weechat_config_dir}/themes/.theme+`. +Renommer un thème utilisateur (usage typique : conserver une +sauvegarde automatique utile sous un nom plus parlant) : + +---- +/theme rename backup-20260525-094210-123456 maSauvegarde +---- + +Les thèmes intégrés n'ont pas de fichier et ne peuvent pas être +renommés ; le nom cible ne peut pas correspondre à un nom intégré ni +commencer par `+backup-+`, et le fichier cible ne doit pas déjà +exister. Le champ `+name+` de la section `+[info]+` à l'intérieur du +fichier est réécrit afin que `/theme info` affiche le nouveau nom de +manière cohérente. + Supprimer un thème utilisateur : ---- diff --git a/doc/it/weechat_user.it.adoc b/doc/it/weechat_user.it.adoc index be12a2396..2a3f3ed5e 100644 --- a/doc/it/weechat_user.it.adoc +++ b/doc/it/weechat_user.it.adoc @@ -2525,6 +2525,19 @@ Reserved names (built-in theme names like `+light+` and any name starting with `+backup-+`) are refused. Files live at `+${weechat_config_dir}/themes/.theme+`. +Rename a user theme (typical use: keep a useful automatic backup +under a meaningful name): + +---- +/theme rename backup-20260525-094210-123456 mybackup +---- + +Built-in themes have no file and cannot be renamed; the target name +cannot match a built-in name or start with `+backup-+`, and the +target file must not already exist. The `+[info]+` `+name+` field +inside the file is rewritten so `/theme info` reports the new name +consistently. + Delete a user theme: ---- diff --git a/doc/ja/weechat_user.ja.adoc b/doc/ja/weechat_user.ja.adoc index 031ca36a8..670328fe5 100644 --- a/doc/ja/weechat_user.ja.adoc +++ b/doc/ja/weechat_user.ja.adoc @@ -2461,6 +2461,19 @@ Reserved names (built-in theme names like `+light+` and any name starting with `+backup-+`) are refused. Files live at `+${weechat_config_dir}/themes/.theme+`. +Rename a user theme (typical use: keep a useful automatic backup +under a meaningful name): + +---- +/theme rename backup-20260525-094210-123456 mybackup +---- + +Built-in themes have no file and cannot be renamed; the target name +cannot match a built-in name or start with `+backup-+`, and the +target file must not already exist. The `+[info]+` `+name+` field +inside the file is rewritten so `/theme info` reports the new name +consistently. + Delete a user theme: ---- diff --git a/doc/pl/weechat_user.pl.adoc b/doc/pl/weechat_user.pl.adoc index d8d2c9ba7..ff6da1e46 100644 --- a/doc/pl/weechat_user.pl.adoc +++ b/doc/pl/weechat_user.pl.adoc @@ -2277,6 +2277,19 @@ Reserved names (built-in theme names like `+light+` and any name starting with `+backup-+`) are refused. Files live at `+${weechat_config_dir}/themes/.theme+`. +Rename a user theme (typical use: keep a useful automatic backup +under a meaningful name): + +---- +/theme rename backup-20260525-094210-123456 mybackup +---- + +Built-in themes have no file and cannot be renamed; the target name +cannot match a built-in name or start with `+backup-+`, and the +target file must not already exist. The `+[info]+` `+name+` field +inside the file is rewritten so `/theme info` reports the new name +consistently. + Delete a user theme: ---- diff --git a/doc/sr/weechat_user.sr.adoc b/doc/sr/weechat_user.sr.adoc index f2b458159..0e370ff2b 100644 --- a/doc/sr/weechat_user.sr.adoc +++ b/doc/sr/weechat_user.sr.adoc @@ -2179,6 +2179,19 @@ Reserved names (built-in theme names like `+light+` and any name starting with `+backup-+`) are refused. Files live at `+${weechat_config_dir}/themes/.theme+`. +Rename a user theme (typical use: keep a useful automatic backup +under a meaningful name): + +---- +/theme rename backup-20260525-094210-123456 mybackup +---- + +Built-in themes have no file and cannot be renamed; the target name +cannot match a built-in name or start with `+backup-+`, and the +target file must not already exist. The `+[info]+` `+name+` field +inside the file is rewritten so `/theme info` reports the new name +consistently. + Delete a user theme: ---- diff --git a/po/cs.po b/po/cs.po index 7488e8889..89b7a0099 100644 --- a/po/cs.po +++ b/po/cs.po @@ -23,7 +23,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2026-05-30 14:01+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: Czech \n" @@ -3714,8 +3714,8 @@ msgstr "seznam položek polí" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" #, fuzzy @@ -3747,6 +3747,11 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +#, fuzzy +#| msgid "names of filters" +msgid "raw[rename]: rename a user theme file" +msgstr "jména filtrů" + #, fuzzy #| msgid "get/set channel topic" msgid "raw[del]: delete a user theme file" @@ -4369,6 +4374,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + msgid "names of secured data (file sec.conf, section data)" msgstr "jména chráněných dat (soubor sec.conf, sekce data)" @@ -6393,6 +6401,26 @@ msgstr "%s%s: nemůžu parsovat soubor \"%s\"" msgid "Theme saved to: %s" msgstr "Volba \"%s%s%s\":" +#, fuzzy, c-format +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%sChyba: nemohu vytvořit soubor \"%s\"" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, fuzzy, c-format +msgid "%sTheme \"%s\" already exists" +msgstr "%s%s: vzorec přesměrování \"%s\" již existuje" + +#, fuzzy, c-format +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%sChyba: nemohu přejmenovat filter \"%s\" na \"%s\"" + +#, fuzzy, c-format +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "Filtr \"%s\" přejmenován na \"%s\"" + #, fuzzy, c-format msgid "%sCannot delete built-in theme \"%s\"" msgstr "%sChyba: nemohu vytvořit soubor \"%s\"" diff --git a/po/de.po b/po/de.po index 670dd1447..2e8674f45 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: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2026-06-28 08:28+0200\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -4106,8 +4106,8 @@ msgstr "Verwalten von benutzerdefinierten Bar-Items" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" #, fuzzy @@ -4146,6 +4146,11 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +#, fuzzy +#| msgid "raw[rename]: rename a filter" +msgid "raw[rename]: rename a user theme file" +msgstr "raw[rename]: benennt einen Filter um" + #, fuzzy #| msgid "raw[del]: delete a server" msgid "raw[del]: delete a user theme file" @@ -4838,6 +4843,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + msgid "names of secured data (file sec.conf, section data)" msgstr "Namen der geschützten Daten (Datei sec.conf, section data)" @@ -7237,6 +7245,30 @@ msgstr "%s%s: Datei \"%s\" Analyse nicht möglich" msgid "Theme saved to: %s" msgstr "Einstellung \"%s%s%s\":" +#, fuzzy, c-format +#| msgid "%sCannot create file \"%s\"" +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%sDie Datei \"%s\" kann nicht erstellt werden" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, fuzzy, c-format +#| msgid "%sBar \"%s\" already exists" +msgid "%sTheme \"%s\" already exists" +msgstr "%sBar \"%s\" existiert bereits" + +#, fuzzy, c-format +#| msgid "%sUnable to rename filter \"%s\" to \"%s\"" +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%sUmbenennung des Filters von \"%s\" in \"%s\" nicht möglich" + +#, fuzzy, c-format +#| msgid "Trigger \"%s\" renamed to \"%s\"" +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "Trigger \"%s\" wurde umbenannt. Der neue Name lautet \"%s\"" + #, fuzzy, c-format #| msgid "%sCannot create file \"%s\"" msgid "%sCannot delete built-in theme \"%s\"" diff --git a/po/es.po b/po/es.po index 92d07bfcd..0bc3b6dfd 100644 --- a/po/es.po +++ b/po/es.po @@ -24,7 +24,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2026-06-28 08:46+0200\n" "Last-Translator: Santiago Forero \n" "Language-Team: Spanish \n" @@ -3806,8 +3806,8 @@ msgstr "lista de elementos de barra" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" #, fuzzy @@ -3839,6 +3839,11 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +#, fuzzy +#| msgid "names of filters" +msgid "raw[rename]: rename a user theme file" +msgstr "nombre de los filtros" + #, fuzzy #| msgid "get/set channel topic" msgid "raw[del]: delete a user theme file" @@ -4459,6 +4464,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + msgid "names of secured data (file sec.conf, section data)" msgstr "" @@ -6553,6 +6561,27 @@ msgstr "%s%s: no es posible analizar el archivo \"%s\"" msgid "Theme saved to: %s" msgstr "Opción \"%s%s%s\":" +#, fuzzy, c-format +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%sError: no es posible crear el archivo \"%s\"" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, fuzzy, c-format +msgid "%sTheme \"%s\" already exists" +msgstr "%sError: el filtro \"%s\" ya existe" + +#, fuzzy, c-format +#| msgid "%sUnable to rename filter \"%s\" to \"%s\"" +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%sError: no se pudo renombrar el filtro \"%s\" a \"%s\"" + +#, fuzzy, c-format +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "Filtro \"%s\" renombrado a \"%s\"" + #, fuzzy, c-format msgid "%sCannot delete built-in theme \"%s\"" msgstr "%sError: no es posible crear el archivo \"%s\"" diff --git a/po/fr.po b/po/fr.po index dd616314e..80e1e75eb 100644 --- a/po/fr.po +++ b/po/fr.po @@ -23,8 +23,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" -"PO-Revision-Date: 2026-07-04 21:08+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" +"PO-Revision-Date: 2026-07-04 21:34+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: French \n" "Language: fr\n" @@ -4031,11 +4031,11 @@ msgstr "gestion des thèmes de couleurs" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" -"[list [-backups]] || apply || reset || save [-full] || del " -"|| info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgid "" "raw[list]: list registered themes and any *.theme files in the WeeChat " @@ -4077,6 +4077,9 @@ msgstr "" "pour écrire toutes les options ; le nom ne doit pas correspondre à un thème " "intégré ou démarrer par \"backup-\"" +msgid "raw[rename]: rename a user theme file" +msgstr "raw[rename] : renommer un fichier de thème utilisateur" + msgid "raw[del]: delete a user theme file" msgstr "raw[del] : supprimer un fichier de thème utilisateur" @@ -4761,6 +4764,11 @@ msgstr "noms des thèmes (intégrés + fichiers utilisateur + sauvegardes)" msgid "names of user theme files (without built-ins and backups)" msgstr "noms des thèmes utilisateur (sans les intégrés et sauvegardes)" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" +"noms des fichiers de thèmes sur le disque (fichiers utilisateur + " +"sauvegardes, pas les intégrés)" + msgid "names of secured data (file sec.conf, section data)" msgstr "noms de données sécurisées (fichier sec.conf, section data)" @@ -7119,6 +7127,26 @@ msgstr "%sÉchec de sauvegarde du thème \"%s\"" msgid "Theme saved to: %s" msgstr "Thème sauvegardé vers : %s" +#, c-format +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%sImpossible de renommer le thème intégré \"%s\"" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "%sLe nouveau nom est le même que l'ancien" + +#, c-format +msgid "%sTheme \"%s\" already exists" +msgstr "%sLe thème \"%s\" existe déjà" + +#, c-format +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%sImpossible de renommer le thème \"%s\" en \"%s\"" + +#, c-format +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "Thème \"%s\" renommé en \"%s\"" + #, c-format msgid "%sCannot delete built-in theme \"%s\"" msgstr "%sImpossible de supprimer le thème intégré \"%s\"" diff --git a/po/hu.po b/po/hu.po index b093c7742..70262d937 100644 --- a/po/hu.po +++ b/po/hu.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2026-03-08 08:59+0100\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: Hungarian \n" @@ -3559,8 +3559,8 @@ msgstr "Aliaszok listája:\n" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" #, fuzzy @@ -3591,6 +3591,10 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +#, fuzzy +msgid "raw[rename]: rename a user theme file" +msgstr "Aliaszok listája:\n" + #, fuzzy #| msgid "get/set channel topic" msgid "raw[del]: delete a user theme file" @@ -4181,6 +4185,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + msgid "names of secured data (file sec.conf, section data)" msgstr "" @@ -6057,6 +6064,26 @@ msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n" msgid "Theme saved to: %s" msgstr "Felhasználók a %s%s%s szobában: %s[" +#, fuzzy, c-format +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%s nem sikerült a \"%s\" fájlt létrehozni\n" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, fuzzy, c-format +msgid "%sTheme \"%s\" already exists" +msgstr "%s az ignore már létezik\n" + +#, fuzzy, c-format +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%s ismeretlen opció a \"%s\" parancsnak\n" + +#, fuzzy, c-format +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "a felhasználók le lettek tiltva" + #, fuzzy, c-format msgid "%sCannot delete built-in theme \"%s\"" msgstr "%s nem sikerült a \"%s\" fájlt létrehozni\n" diff --git a/po/it.po b/po/it.po index 0332e2b65..da75f5545 100644 --- a/po/it.po +++ b/po/it.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2026-05-30 14:02+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: Italian \n" @@ -3737,8 +3737,8 @@ msgstr "elenco degli elementi barra" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" #, fuzzy @@ -3770,6 +3770,11 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +#, fuzzy +#| msgid "names of filters" +msgid "raw[rename]: rename a user theme file" +msgstr "nomi dei filtri" + #, fuzzy #| msgid "get/set channel topic" msgid "raw[del]: delete a user theme file" @@ -4394,6 +4399,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + #, fuzzy msgid "names of secured data (file sec.conf, section data)" msgstr "nome dei dati sensibili (file sec.conf, sezione data)" @@ -6539,6 +6547,26 @@ msgstr "%s%s: impossibile analizzare il file \"%s\"" msgid "Theme saved to: %s" msgstr "Opzione \"%s%s%s\":" +#, fuzzy, c-format +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%sErrore: impossibile creare il file \"%s\"" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, fuzzy, c-format +msgid "%sTheme \"%s\" already exists" +msgstr "%sErrore: il filtro \"%s\" esiste già" + +#, fuzzy, c-format +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%sErrore: impossibile rinominare il filtro da \"%s\" a \"%s\"" + +#, fuzzy, c-format +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "Filtro \"%s\" rinominato in \"%s\"" + #, fuzzy, c-format msgid "%sCannot delete built-in theme \"%s\"" msgstr "%sErrore: impossibile creare il file \"%s\"" diff --git a/po/ja.po b/po/ja.po index de3ccb1d0..259bcc562 100644 --- a/po/ja.po +++ b/po/ja.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2026-05-30 14:02+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -3822,8 +3822,8 @@ msgstr "バー要素のリスト" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" #, fuzzy @@ -3855,6 +3855,11 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +#, fuzzy +#| msgid "names of filters" +msgid "raw[rename]: rename a user theme file" +msgstr "フィルタ名" + #, fuzzy #| msgid "get/set channel topic" msgid "raw[del]: delete a user theme file" @@ -4496,6 +4501,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + msgid "names of secured data (file sec.conf, section data)" msgstr "保護データの名前 (sec.conf ファイル、セクションデータ)" @@ -6715,6 +6723,28 @@ msgstr "%s%s: ファイル \"%s\" を解析できません" msgid "Theme saved to: %s" msgstr "オプション \"%s%s%s\":" +#, fuzzy, c-format +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%sエラー: ファイル \"%s\" の作成に失敗" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, fuzzy, c-format +#| msgid "%s%s: trigger \"%s\" already exists" +msgid "%sTheme \"%s\" already exists" +msgstr "%s%s: トリガ \"%s\" は既に存在します" + +#, fuzzy, c-format +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%sエラー: フィルタ \"%s\" の名前を \"%s\" に変更できません" + +#, fuzzy, c-format +#| msgid "Trigger \"%s\" renamed to \"%s\"" +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "トリガ \"%s\" の名前を \"%s\" に変更しました" + #, fuzzy, c-format msgid "%sCannot delete built-in theme \"%s\"" msgstr "%sエラー: ファイル \"%s\" の作成に失敗" diff --git a/po/pl.po b/po/pl.po index 331ce6f87..647e9f323 100644 --- a/po/pl.po +++ b/po/pl.po @@ -23,7 +23,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2026-06-28 08:55+0200\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: Polish \n" @@ -3932,8 +3932,8 @@ msgstr "zarządza niestandardowymi elementami pasków" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" #, fuzzy @@ -3971,6 +3971,11 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +#, fuzzy +#| msgid "raw[rename]: rename a filter" +msgid "raw[rename]: rename a user theme file" +msgstr "raw[rename]: zmień nazwę filtra" + #, fuzzy #| msgid "raw[del]: delete a server" msgid "raw[del]: delete a user theme file" @@ -4629,6 +4634,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + msgid "names of secured data (file sec.conf, section data)" msgstr "nazwy zabezpieczonych danych (plik sec.conf, sekcja data)" @@ -6898,6 +6906,30 @@ msgstr "%s%s: nie można przetworzyć pliku \"%s\"" msgid "Theme saved to: %s" msgstr "Opcja \"%s%s%s\":" +#, fuzzy, c-format +#| msgid "%sCannot create file \"%s\"" +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%sNie można utworzyć pliku \"%s\"" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, fuzzy, c-format +#| msgid "%sBar \"%s\" already exists" +msgid "%sTheme \"%s\" already exists" +msgstr "%sPasek \"%s\" już istnieje" + +#, fuzzy, c-format +#| msgid "%sUnable to rename filter \"%s\" to \"%s\"" +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%sNie można zmienić nazwy filtru z \"%s\" na \"%s\"" + +#, fuzzy, c-format +#| msgid "Trigger \"%s\" renamed to \"%s\"" +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "Zmieniono nazwę triggera z \"%s\" na \"%s\"" + #, fuzzy, c-format #| msgid "%sCannot create file \"%s\"" msgid "%sCannot delete built-in theme \"%s\"" diff --git a/po/pt.po b/po/pt.po index 314de1f69..bcdb7d3ee 100644 --- a/po/pt.po +++ b/po/pt.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2026-06-28 08:48+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese \n" @@ -3831,8 +3831,8 @@ msgstr "lista de itens da barra" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" #, fuzzy @@ -3864,6 +3864,11 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +#, fuzzy +#| msgid "names of filters" +msgid "raw[rename]: rename a user theme file" +msgstr "nomes dos filtros" + #, fuzzy #| msgid "get/set channel topic" msgid "raw[del]: delete a user theme file" @@ -4515,6 +4520,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + msgid "names of secured data (file sec.conf, section data)" msgstr "nomes dos ficheiros protegidos (ficheiro sec.conf, secção de dados)" @@ -6771,6 +6779,28 @@ msgstr "%s%s: não foi possível analisar o ficheiro \"%s\"" msgid "Theme saved to: %s" msgstr "Opção \"%s%s%s\":" +#, fuzzy, c-format +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%sErro: não é possível criar o ficheiro \"%s\"" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, fuzzy, c-format +#| msgid "%s%s: trigger \"%s\" already exists" +msgid "%sTheme \"%s\" already exists" +msgstr "%s%s: o acionador \"%s\" já existe" + +#, fuzzy, c-format +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%sErro: não foi possível mudar o nome do filtro \"%s\" para \"%s\"" + +#, fuzzy, c-format +#| msgid "Trigger \"%s\" renamed to \"%s\"" +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "O nome do acionador \"%s\" mudou para \"%s\"" + #, fuzzy, c-format msgid "%sCannot delete built-in theme \"%s\"" msgstr "%sErro: não é possível criar o ficheiro \"%s\"" diff --git a/po/pt_BR.po b/po/pt_BR.po index feca89b91..740c25d00 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -46,7 +46,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2026-06-28 08:49+0200\n" "Last-Translator: Érico Nogueira \n" "Language-Team: Portuguese (Brazil) \n" @@ -3751,8 +3751,8 @@ msgstr "lista de itens da barra" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" #, fuzzy @@ -3784,6 +3784,11 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +#, fuzzy +#| msgid "names of filters" +msgid "raw[rename]: rename a user theme file" +msgstr "nomes dos filtros" + #, fuzzy msgid "raw[del]: delete a user theme file" msgstr "lista de atalhos" @@ -4419,6 +4424,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + msgid "names of secured data (file sec.conf, section data)" msgstr "" @@ -6437,6 +6445,26 @@ msgstr "%s%s: não foi possível interpretar arquivo \"%s\"" msgid "Theme saved to: %s" msgstr "Opção \"%s%s%s\":" +#, fuzzy, c-format +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%sErro: não foi possível criar arquivo \"%s\"" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, fuzzy, c-format +msgid "%sTheme \"%s\" already exists" +msgstr "%sErro: filtro \"%s\" já existe" + +#, fuzzy, c-format +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%sErro: não foi possível renomear filtro \"%s\" para \"%s\"" + +#, fuzzy, c-format +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "Filtro \"%s\" renomeado para \"%s\"" + #, fuzzy, c-format msgid "%sCannot delete built-in theme \"%s\"" msgstr "%sErro: não foi possível criar arquivo \"%s\"" diff --git a/po/ru.po b/po/ru.po index 7a90e06e2..d2fc30d89 100644 --- a/po/ru.po +++ b/po/ru.po @@ -23,7 +23,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2026-03-08 08:59+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: Russian \n" @@ -3583,8 +3583,8 @@ msgstr "Список сокращений:\n" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" #, fuzzy @@ -3615,6 +3615,10 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +#, fuzzy +msgid "raw[rename]: rename a user theme file" +msgstr "Список сокращений:\n" + #, fuzzy #| msgid "get/set channel topic" msgid "raw[del]: delete a user theme file" @@ -4205,6 +4209,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + msgid "names of secured data (file sec.conf, section data)" msgstr "" @@ -6094,6 +6101,26 @@ msgstr "Не могу записать лог-файл \"%s\"\n" msgid "Theme saved to: %s" msgstr "Ники %s%s%s: %s[" +#, fuzzy, c-format +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%s не могу создать файл \"%s\"\n" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, fuzzy, c-format +msgid "%sTheme \"%s\" already exists" +msgstr "%s игнорирование уже существует\n" + +#, fuzzy, c-format +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%s неизвестный параметр для команды \"%s\"\n" + +#, fuzzy, c-format +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "команда users отключена" + #, fuzzy, c-format msgid "%sCannot delete built-in theme \"%s\"" msgstr "%s не могу создать файл \"%s\"\n" diff --git a/po/sr.po b/po/sr.po index 7a7567650..25978333a 100644 --- a/po/sr.po +++ b/po/sr.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2026-06-28 08:52+0200\n" "Last-Translator: Ivan Pešić \n" "Language-Team: Serbian \n" @@ -3909,8 +3909,8 @@ msgstr "управљање прилагођеним ставкама траке" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" #, fuzzy @@ -3948,6 +3948,11 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +#, fuzzy +#| msgid "raw[rename]: rename a filter" +msgid "raw[rename]: rename a user theme file" +msgstr "raw[rename]: мења име филтеру" + #, fuzzy #| msgid "raw[del]: delete a server" msgid "raw[del]: delete a user theme file" @@ -4604,6 +4609,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + msgid "names of secured data (file sec.conf, section data)" msgstr "имена обезбеђених података (фајл sec.conf, одељак data)" @@ -6880,6 +6888,30 @@ msgstr "%s%s: није успело парсирање фајла „%s”" msgid "Theme saved to: %s" msgstr "Опција „%s%s%s”:" +#, fuzzy, c-format +#| msgid "%sCannot create file \"%s\"" +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%sНе може да се креира фајл „%s”" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, fuzzy, c-format +#| msgid "%sBar \"%s\" already exists" +msgid "%sTheme \"%s\" already exists" +msgstr "%sТрака „%s” већ постоји" + +#, fuzzy, c-format +#| msgid "%sUnable to rename filter \"%s\" to \"%s\"" +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%sНије успела промена име филтера „%s” на „%s”" + +#, fuzzy, c-format +#| msgid "Trigger \"%s\" renamed to \"%s\"" +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "Окидачу „%s” је промењено име у „%s”" + #, fuzzy, c-format #| msgid "%sCannot create file \"%s\"" msgid "%sCannot delete built-in theme \"%s\"" diff --git a/po/tr.po b/po/tr.po index 77cda1aaf..777d47c38 100644 --- a/po/tr.po +++ b/po/tr.po @@ -23,7 +23,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2026-06-28 08:53+0200\n" "Last-Translator: Emir SARI \n" "Language-Team: Turkish \n" @@ -3768,8 +3768,8 @@ msgstr "özel çubuk ögelerini yönet" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" #, fuzzy @@ -3803,6 +3803,11 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +#, fuzzy +#| msgid "raw[rename]: rename a filter" +msgid "raw[rename]: rename a user theme file" +msgstr "raw[rename]: Bir süzgeci yeniden adlandır" + #, fuzzy #| msgid "get/set channel topic" msgid "raw[del]: delete a user theme file" @@ -4430,6 +4435,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + msgid "names of secured data (file sec.conf, section data)" msgstr "güvenli veri adları (sec.conf dosyası, bölüm verisi)" @@ -6677,6 +6685,30 @@ msgstr "%s%s: \"%s\" dosyası ayrıştırılamıyor" msgid "Theme saved to: %s" msgstr "\"%s%s%s\" seçeneği:" +#, fuzzy, c-format +#| msgid "%sCannot create file \"%s\"" +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "%s\"%s\" dosyası oluşturulamıyor" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, fuzzy, c-format +#| msgid "%sBar \"%s\" already exists" +msgid "%sTheme \"%s\" already exists" +msgstr "%s\"%s\" çubuğu halihazırda var" + +#, fuzzy, c-format +#| msgid "%sUnable to rename filter \"%s\" to \"%s\"" +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "%s\"%s\" süzgeci \"%s\" olarak yeniden adlandırılamıyor" + +#, fuzzy, c-format +#| msgid "Trigger \"%s\" renamed to \"%s\"" +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "\"%s\" tetiği \"%s\" olarak yeniden adlandırıldı" + #, fuzzy, c-format #| msgid "%sCannot create file \"%s\"" msgid "%sCannot delete built-in theme \"%s\"" diff --git a/po/weechat.pot b/po/weechat.pot index 4f00d5c0d..d89b4c939 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -23,7 +23,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2026-07-04 21:01+0200\n" +"POT-Creation-Date: 2026-07-04 21:31+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -3351,8 +3351,8 @@ msgstr "" #. TRANSLATORS: only text between angle brackets (eg: "") may be translated msgid "" -"[list [-backups]] || apply || reset || save [-full] || del " -" || info " +"[list [-backups]] || apply || reset || save [-full] || rename " +" || del || info " msgstr "" msgid "" @@ -3382,6 +3382,9 @@ msgid "" "match a built-in theme or start with \"backup-\"" msgstr "" +msgid "raw[rename]: rename a user theme file" +msgstr "" + msgid "raw[del]: delete a user theme file" msgstr "" @@ -3925,6 +3928,9 @@ msgstr "" msgid "names of user theme files (without built-ins and backups)" msgstr "" +msgid "names of theme files on disk (user files + backups, no built-ins)" +msgstr "" + msgid "names of secured data (file sec.conf, section data)" msgstr "" @@ -5652,6 +5658,26 @@ msgstr "" msgid "Theme saved to: %s" msgstr "" +#, c-format +msgid "%sCannot rename built-in theme \"%s\"" +msgstr "" + +#, c-format +msgid "%sNew name is the same as old name" +msgstr "" + +#, c-format +msgid "%sTheme \"%s\" already exists" +msgstr "" + +#, c-format +msgid "%sFailed to rename theme \"%s\" to \"%s\"" +msgstr "" + +#, c-format +msgid "Theme \"%s\" renamed to \"%s\"" +msgstr "" + #, c-format msgid "%sCannot delete built-in theme \"%s\"" msgstr "" diff --git a/src/core/core-command.c b/src/core/core-command.c index 7494f14ae..79d068cd5 100644 --- a/src/core/core-command.c +++ b/src/core/core-command.c @@ -7355,6 +7355,13 @@ COMMAND_CALLBACK(theme) ? 1 : 0); } + /* "/theme rename ": rename a user theme file */ + if (string_strcmp (argv[1], "rename") == 0) + { + COMMAND_MIN_ARGS(4, "rename"); + return theme_rename (argv[2], argv[3]); + } + /* "/theme del ": remove a user theme file */ if (string_strcmp (argv[1], "del") == 0) { @@ -10087,6 +10094,7 @@ command_init (void) " || apply " " || reset" " || save [-full]" + " || rename " " || del " " || info "), CMD_ARGS_DESC( @@ -10106,6 +10114,7 @@ command_init (void) "written, use \"-full\" to write every themable option; " "the name must not match a built-in theme or start with " "\"backup-\""), + N_("raw[rename]: rename a user theme file"), N_("raw[del]: delete a user theme file"), N_("raw[info]: display details on a theme (name, description, " "creation date, WeeChat version, number of option overrides)"), @@ -10125,6 +10134,7 @@ command_init (void) " || apply %(theme_themes_all)" " || reset" " || save %(theme_themes_user) -full" + " || rename %(theme_themes_files)" " || del %(theme_themes_user)" " || info %(theme_themes_all)", &command_theme, NULL, NULL); diff --git a/src/core/core-completion.c b/src/core/core-completion.c index f2f293b56..31e20bde4 100644 --- a/src/core/core-completion.c +++ b/src/core/core-completion.c @@ -2086,6 +2086,40 @@ completion_list_add_theme_themes_user_cb (const void *pointer, void *data, return WEECHAT_RC_OK; } +/* + * Add every on-disk theme file (user files + backups, no built-ins) + * to the completion list; suitable for /theme rename which can take a + * backup as its source. + */ + +int +completion_list_add_theme_themes_files_cb (const void *pointer, void *data, + const char *completion_item, + struct t_gui_buffer *buffer, + struct t_gui_completion *completion) +{ + struct t_completion_theme_dir ctx; + char *dir; + + /* make C compiler happy */ + (void) pointer; + (void) data; + (void) completion_item; + (void) buffer; + + dir = NULL; + string_asprintf (&dir, "%s/themes", weechat_config_dir); + if (dir) + { + ctx.completion = completion; + ctx.show_backups = 1; + dir_exec_on_files (dir, 0, 0, &completion_theme_add_file_cb, &ctx); + free (dir); + } + + return WEECHAT_RC_OK; +} + /* * Add a secured data to completion list. */ @@ -2483,6 +2517,10 @@ completion_init (void) hook_completion (NULL, "theme_themes_user", N_("names of user theme files (without built-ins and backups)"), &completion_list_add_theme_themes_user_cb, NULL, NULL); + hook_completion (NULL, "theme_themes_files", + N_("names of theme files on disk (user files + backups, " + "no built-ins)"), + &completion_list_add_theme_themes_files_cb, NULL, NULL); hook_completion (NULL, "secured_data", N_("names of secured data (file sec.conf, section data)"), &completion_list_add_secured_data_cb, NULL, NULL); diff --git a/src/core/core-theme.c b/src/core/core-theme.c index 4a05cabd5..08e652304 100644 --- a/src/core/core-theme.c +++ b/src/core/core-theme.c @@ -1173,6 +1173,160 @@ theme_save (const char *name, int full) return WEECHAT_RC_OK; } +/* + * Rename a user theme file. + * + * Refuse to rename a built-in (no file) or to a name reserved for + * built-ins or automatic backups. The target name must not already + * exist on disk. The file content is copied with the [info] name + * field rewritten so the parsed theme name stays consistent with the + * new filename. If "weechat.look.theme" was pointing at the old name, + * it is updated to the new name. + * + * Return WEECHAT_RC_OK on success, WEECHAT_RC_ERROR on validation or + * I/O failure (in which case no file is created or removed). + */ + +int +theme_rename (const char *old_name, const char *new_name) +{ + char *old_path, *new_path, line[2048]; + FILE *fin, *fout; + const char *trimmed; + int in_info, name_done; + + if (!old_name || !old_name[0] || !new_name || !new_name[0]) + return WEECHAT_RC_ERROR; + + if (theme_search (old_name)) + { + gui_chat_printf (NULL, + _("%sCannot rename built-in theme \"%s\""), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + old_name); + return WEECHAT_RC_ERROR; + } + + if (strcmp (old_name, new_name) == 0) + { + gui_chat_printf (NULL, + _("%sNew name is the same as old name"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + return WEECHAT_RC_ERROR; + } + + if (strncmp (new_name, "backup-", 7) == 0) + { + gui_chat_printf (NULL, + _("%sName \"%s\" is reserved for automatic backups"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + new_name); + return WEECHAT_RC_ERROR; + } + + if (theme_search (new_name)) + { + gui_chat_printf (NULL, + _("%sName \"%s\" is reserved for a built-in theme"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + new_name); + return WEECHAT_RC_ERROR; + } + + old_path = theme_user_file_path (old_name); + if (!old_path) + return WEECHAT_RC_ERROR; + if (access (old_path, R_OK) != 0) + { + gui_chat_printf (NULL, + _("%sTheme \"%s\" not found"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + old_name); + free (old_path); + return WEECHAT_RC_ERROR; + } + + new_path = theme_user_file_path (new_name); + if (!new_path) + { + free (old_path); + return WEECHAT_RC_ERROR; + } + if (access (new_path, F_OK) == 0) + { + gui_chat_printf (NULL, + _("%sTheme \"%s\" already exists"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + new_name); + free (old_path); + free (new_path); + return WEECHAT_RC_ERROR; + } + + fin = fopen (old_path, "r"); + fout = (fin) ? fopen (new_path, "w") : NULL; + if (!fin || !fout) + { + if (fin) + fclose (fin); + gui_chat_printf (NULL, + _("%sFailed to rename theme \"%s\" to \"%s\""), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + old_name, new_name); + free (old_path); + free (new_path); + return WEECHAT_RC_ERROR; + } + + in_info = 0; + name_done = 0; + while (fgets (line, sizeof (line), fin)) + { + trimmed = line; + while (*trimmed == ' ' || *trimmed == '\t') + trimmed++; + if (*trimmed == '[') + { + in_info = (strncmp (trimmed, "[info]", 6) == 0); + fputs (line, fout); + continue; + } + if (in_info && !name_done + && trimmed[0] == 'n' && trimmed[1] == 'a' + && trimmed[2] == 'm' && trimmed[3] == 'e' + && (trimmed[4] == ' ' || trimmed[4] == '\t' || trimmed[4] == '=')) + { + fprintf (fout, "name = \"%s\"\n", new_name); + name_done = 1; + continue; + } + fputs (line, fout); + } + fclose (fin); + if (fclose (fout) != 0 || unlink (old_path) != 0) + { + unlink (new_path); + gui_chat_printf (NULL, + _("%sFailed to rename theme \"%s\" to \"%s\""), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + old_name, new_name); + free (old_path); + free (new_path); + return WEECHAT_RC_ERROR; + } + + if (strcmp (CONFIG_STRING(config_look_theme), old_name) == 0) + config_file_option_set (config_look_theme, new_name, 1); + + gui_chat_printf (NULL, + _("Theme \"%s\" renamed to \"%s\""), + old_name, new_name); + + free (old_path); + free (new_path); + return WEECHAT_RC_OK; +} + /* * Delete a user theme file. * diff --git a/src/core/core-theme.h b/src/core/core-theme.h index bd3ea80a3..da403d1e8 100644 --- a/src/core/core-theme.h +++ b/src/core/core-theme.h @@ -71,6 +71,7 @@ extern struct t_arraylist *theme_list (void); extern int theme_apply (const char *name); extern int theme_reset (void); extern int theme_save (const char *name, int full); +extern int theme_rename (const char *old_name, const char *new_name); extern int theme_delete (const char *name); extern char *theme_make_backup (void); extern char *theme_user_file_path (const char *name); diff --git a/tests/unit/core/test-core-theme.cpp b/tests/unit/core/test-core-theme.cpp index 3861aeb76..c33bbd695 100644 --- a/tests/unit/core/test-core-theme.cpp +++ b/tests/unit/core/test-core-theme.cpp @@ -975,6 +975,82 @@ TEST(CoreTheme, Delete) free (path); } +/* + * Test functions: + * theme_rename + */ + +TEST(CoreTheme, Rename) +{ + char *src_path, *dst_path; + struct stat st; + FILE *file; + char buf[2048]; + size_t len; + + /* NULL / empty arguments => error */ + LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename (NULL, "dst")); + LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("src", NULL)); + LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("", "dst")); + LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("src", "")); + + /* refuses to rename a built-in (no file to rename) */ + theme_register (NULL, NULL, "dark", NULL); + LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("dark", "renamed")); + + /* refuses target == reserved "backup-" prefix */ + LONGS_EQUAL(WEECHAT_RC_OK, theme_save ("rn_src", 0)); + LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("rn_src", "backup-foo")); + + /* refuses target == built-in name */ + LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("rn_src", "dark")); + + /* refuses same name */ + LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("rn_src", "rn_src")); + + /* source missing => error */ + LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("does_not_exist", "rn_dst")); + + /* refuses target that already exists */ + LONGS_EQUAL(WEECHAT_RC_OK, theme_save ("rn_dst", 0)); + LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("rn_src", "rn_dst")); + LONGS_EQUAL(WEECHAT_RC_OK, theme_delete ("rn_dst")); + + /* happy path: rename moves the file and rewrites the [info] name */ + src_path = theme_user_file_path ("rn_src"); + dst_path = theme_user_file_path ("rn_dst"); + CHECK(src_path != NULL); + CHECK(dst_path != NULL); + + LONGS_EQUAL(WEECHAT_RC_OK, theme_rename ("rn_src", "rn_dst")); + + /* old file gone, new file exists */ + LONGS_EQUAL(-1, stat (src_path, &st)); + LONGS_EQUAL(0, stat (dst_path, &st)); + + /* [info] name field inside the renamed file is updated */ + file = fopen (dst_path, "r"); + CHECK(file != NULL); + len = fread (buf, 1, sizeof (buf) - 1, file); + buf[len] = '\0'; + fclose (file); + CHECK(strstr (buf, "name = \"rn_dst\"") != NULL); + CHECK(strstr (buf, "name = \"rn_src\"") == NULL); + + /* if weechat.look.theme pointed at the old name, the label moves too */ + LONGS_EQUAL(WEECHAT_RC_OK, theme_save ("rn_active", 0)); + config_file_option_set (config_look_theme, "rn_active", 1); + LONGS_EQUAL(WEECHAT_RC_OK, theme_rename ("rn_active", "rn_moved")); + STRCMP_EQUAL("rn_moved", CONFIG_STRING(config_look_theme)); + + /* cleanup */ + config_file_option_reset (config_look_theme, 1); + theme_delete ("rn_dst"); + theme_delete ("rn_moved"); + free (src_path); + free (dst_path); +} + /* * Test functions: * theme_init