diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-03-25 21:00:42 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-03-25 21:00:42 +0100 |
commit | 26630ada2dc7ec9839f5bcf4d4b99ff0dcb6ca69 (patch) | |
tree | 02d583621f48887352fd8c4d6ae243accedd3e1e | |
parent | 8482e1463001dd28505c9b7ef68aefeccf916c80 (diff) | |
download | weechat-26630ada2dc7ec9839f5bcf4d4b99ff0dcb6ca69.zip |
fset: add option `-import` in command `/fset`
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | po/cs.po | 9 | ||||
-rw-r--r-- | po/de.po | 15 | ||||
-rw-r--r-- | po/es.po | 9 | ||||
-rw-r--r-- | po/fr.po | 15 | ||||
-rw-r--r-- | po/hu.po | 9 | ||||
-rw-r--r-- | po/it.po | 9 | ||||
-rw-r--r-- | po/ja.po | 15 | ||||
-rw-r--r-- | po/pl.po | 15 | ||||
-rw-r--r-- | po/pt.po | 9 | ||||
-rw-r--r-- | po/pt_BR.po | 9 | ||||
-rw-r--r-- | po/ru.po | 9 | ||||
-rw-r--r-- | po/sr.po | 15 | ||||
-rw-r--r-- | po/tr.po | 15 | ||||
-rw-r--r-- | po/weechat.pot | 9 | ||||
-rw-r--r-- | src/plugins/fset/fset-command.c | 13 | ||||
-rw-r--r-- | src/plugins/fset/fset-option.c | 57 | ||||
-rw-r--r-- | src/plugins/fset/fset-option.h | 1 |
18 files changed, 204 insertions, 30 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index f32816365..3cb6a8c18 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -36,6 +36,7 @@ New features:: * api: add info "plugin_loaded" * api: add support of specifier `%!` for timestamp in function util_strftimeval * api: add support of base64url in encode/decode functions + * fset: add option `-import` in command `/fset` * irc: add option `-all` in command `/allchan`, do not execute command on parted channels by default (issue #2085) * irc: add server option "autojoin_delay" (delay before autojoin), use option "command_delay" before execution of the command (issue #862) * relay: add "api" protocol (HTTP REST API), add option relay.look.display_clients, change option type relay.look.auto_open_buffer to string, rename option relay.weechat.commands to relay.network.commands, add option relay.network.time_window (issue #2066) @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2024-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2024-03-06 20:32+0100\n" "Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7403,7 +7403,7 @@ msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" msgid "raw[-bar]: add the help bar" @@ -7473,6 +7473,11 @@ msgid "" msgstr "" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2024-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2024-03-25 11:43+0100\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <kde-i18n-de@kde.org>\n" @@ -8497,11 +8497,17 @@ msgid "fast set WeeChat and plugins options" msgstr "Optionen von WeeChat und Erweiterungen schnell anpassen" #. TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated +#, fuzzy +#| msgid "" +#| "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -" +#| "go <line>|end || -toggle || -add [<value>] || -reset || -unset || -set || " +#| "-setnew || -append || -mark || -format || -export [-help|-nohelp] " +#| "<filename> || <filter>" msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" @@ -8600,6 +8606,11 @@ msgstr "" "Name\")" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2024-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2024-03-06 20:32+0100\n" "Last-Translator: Santiago Forero <santiago@forero.xyz>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7584,7 +7584,7 @@ msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" msgid "raw[-bar]: add the help bar" @@ -7654,6 +7654,11 @@ msgid "" msgstr "" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2024-03-25 12:05+0100\n" -"PO-Revision-Date: 2024-03-25 12:06+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" +"PO-Revision-Date: 2024-03-25 21:00+0100\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -8336,12 +8336,12 @@ msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" "-bar || -refresh || -up|-down [<nombre>] || -left|-right [<pourcentage>] || -" "go <ligne>|end || -toggle || -add [<valeur>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <fichier> " -"|| <filtre>" +"|| -import <fichier> || <filtre>" msgid "raw[-bar]: add the help bar" msgstr "raw[-bar] : ajouter la barre d'aide" @@ -8433,6 +8433,13 @@ msgstr "" "(chaque ligne a le format : \"/set nom valeur\" ou \"/unset nom\")" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" +"raw[-import] : importer les options depuis un fichier (toutes les lignes qui " +"contiennent des commandes sont exécutées)" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2024-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2023-11-29 09:59+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7068,7 +7068,7 @@ msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" msgid "raw[-bar]: add the help bar" @@ -7138,6 +7138,11 @@ msgid "" msgstr "" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2024-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2024-03-06 20:32+0100\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7576,7 +7576,7 @@ msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" msgid "raw[-bar]: add the help bar" @@ -7646,6 +7646,11 @@ msgid "" msgstr "" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2024-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2024-03-06 20:32+0100\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/weechat/tree/master/" @@ -7825,11 +7825,17 @@ msgid "fast set WeeChat and plugins options" msgstr "WeeChat とプラグインのオプションを高速設定" #. TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated +#, fuzzy +#| msgid "" +#| "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -" +#| "go <line>|end || -toggle || -add [<value>] || -reset || -unset || -set || " +#| "-setnew || -append || -mark || -format || -export [-help|-nohelp] " +#| "<filename> || <filter>" msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" @@ -7907,6 +7913,11 @@ msgid "" msgstr "" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2024-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2024-03-06 20:32+0100\n" "Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -8081,11 +8081,17 @@ msgid "fast set WeeChat and plugins options" msgstr "szybkie ustawianie opcji WeeChat i wtyczek" #. TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated +#, fuzzy +#| msgid "" +#| "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -" +#| "go <line>|end || -toggle || -add [<value>] || -reset || -unset || -set || " +#| "-setnew || -append || -mark || -format || -export [-help|-nohelp] " +#| "<filename> || <filter>" msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" "-bar || -refresh || -up|-down [<ilość>] || -left|-right [<procent>] || -go " "<linia>|end || -toggle || -add [<wartość>] || -reset || -unset || -set || -" @@ -8174,6 +8180,11 @@ msgstr "" "ma format: „/set nazwa wartość” lub „/unset nazwa”)" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2024-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2024-03-06 20:32+0100\n" "Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n" "Language-Team: Portuguese <>\n" @@ -7816,7 +7816,7 @@ msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" msgid "raw[-bar]: add the help bar" @@ -7886,6 +7886,11 @@ msgid "" msgstr "" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" diff --git a/po/pt_BR.po b/po/pt_BR.po index 0a26f8180..f7c5b15f7 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-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2024-02-17 10:07+0100\n" "Last-Translator: Érico Nogueira <ericonr@disroot.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7478,7 +7478,7 @@ msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" msgid "raw[-bar]: add the help bar" @@ -7548,6 +7548,11 @@ msgid "" msgstr "" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2024-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2023-11-29 09:59+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7109,7 +7109,7 @@ msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" msgid "raw[-bar]: add the help bar" @@ -7179,6 +7179,11 @@ msgid "" msgstr "" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2024-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2024-03-06 20:32+0100\n" "Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -8107,11 +8107,17 @@ msgid "fast set WeeChat and plugins options" msgstr "брзо постављање опција за програм WeeChat и додатке" #. TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated +#, fuzzy +#| msgid "" +#| "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -" +#| "go <line>|end || -toggle || -add [<value>] || -reset || -unset || -set || " +#| "-setnew || -append || -mark || -format || -export [-help|-nohelp] " +#| "<filename> || <filter>" msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" "-bar || -refresh || -up|-down [<број>] || -left|-right [<проценат>] || -go " "<линија>|end || -toggle || -add [<вредн>] || -reset || -unset || -set || -" @@ -8200,6 +8206,11 @@ msgstr "" "линија има формат: „/set име вредност” или „/unset име”)" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2024-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2024-03-06 20:33+0100\n" "Last-Translator: Emir SARI <emir_sari@icloud.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7911,11 +7911,17 @@ msgid "fast set WeeChat and plugins options" msgstr "WeeChat ve eklenti seçeneklerini hızlıca ayarla" #. TRANSLATORS: only text between angle brackets (eg: "<name>") must be translated +#, fuzzy +#| msgid "" +#| "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -" +#| "go <line>|end || -toggle || -add [<value>] || -reset || -unset || -set || " +#| "-setnew || -append || -mark || -format || -export [-help|-nohelp] " +#| "<filename> || <filter>" msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" "-bar || -refresh || -up|-down [<sayı>] || -left|-right [<yüzde>] || -go " "<satır>|end || -toggle || -add [<değer>] || -reset || -unset || -set || -" @@ -7993,6 +7999,11 @@ msgid "" msgstr "" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 70ccdb000..62c201b9b 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-03-25 12:05+0100\n" +"POT-Creation-Date: 2024-03-25 20:59+0100\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -6612,7 +6612,7 @@ msgid "" "-bar || -refresh || -up|-down [<number>] || -left|-right [<percent>] || -go " "<line>|end || -toggle || -add [<value>] || -reset || -unset || -set || -" "setnew || -append || -mark || -format || -export [-help|-nohelp] <filename> " -"|| <filter>" +"|| -import <filename> || <filter>" msgstr "" msgid "raw[-bar]: add the help bar" @@ -6682,6 +6682,11 @@ msgid "" msgstr "" msgid "" +"raw[-import]: import the options from a file (all lines containing commands " +"are are executed)" +msgstr "" + +msgid "" "raw[-help]: force writing of help on options in exported file (see /help " "fset.look.export_help_default)" msgstr "" diff --git a/src/plugins/fset/fset-command.c b/src/plugins/fset/fset-command.c index a3135107c..946c4c17f 100644 --- a/src/plugins/fset/fset-command.c +++ b/src/plugins/fset/fset-command.c @@ -423,6 +423,15 @@ fset_command_fset (const void *pointer, void *data, return WEECHAT_RC_OK; } + if (weechat_strcmp (argv[1], "-import") == 0) + { + if (argc < 3) + WEECHAT_COMMAND_ERROR; + if (!fset_option_import (argv_eol[2])) + WEECHAT_COMMAND_ERROR; + return WEECHAT_RC_OK; + } + WEECHAT_COMMAND_ERROR; } else @@ -639,6 +648,7 @@ fset_command_init () " || -mark" " || -format" " || -export [-help|-nohelp] <filename>" + " || -import <filename>" " || <filter>"), WEECHAT_CMD_ARGS_DESC( N_("raw[-bar]: add the help bar"), @@ -666,6 +676,8 @@ fset_command_init () N_("raw[-format]: switch to the next available format"), N_("raw[-export]: export the options and values displayed in a file " "(each line has format: \"/set name value\" or \"/unset name\")"), + N_("raw[-import]: import the options from a file " + "(all lines containing commands are are executed)"), N_("raw[-help]: force writing of help on options in exported file " "(see /help fset.look.export_help_default)"), N_("raw[-nohelp]: do not write help on options in exported file " @@ -784,6 +796,7 @@ fset_command_init () " || -mark" " || -format" " || -export -help|-nohelp|%(filename) %(filename)" + " || -import %(filename)" " || *|c:|f:|s:|d|d:|d=|d==|=|==|%(fset_options)", &fset_command_fset, NULL, NULL); weechat_hook_command_run ("/set", &fset_command_run_set_cb, NULL, NULL); diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c index 2ef8c219d..a783d2f0e 100644 --- a/src/plugins/fset/fset-option.c +++ b/src/plugins/fset/fset-option.c @@ -1471,6 +1471,63 @@ fset_option_export (const char *filename, int with_help) } /* + * Imports options from a file: all lines starting with "/" are executed. + * + * Returns: + * 1: export OK + * 0: error + */ + +int +fset_option_import (const char *filename) +{ + char *filename2, line[4096], *ptr_line; + FILE *file; + int length; + + filename2 = weechat_string_expand_home (filename); + if (!filename2) + return 0; + + file = fopen (filename2, "r"); + if (!file) + { + free (filename2); + return 0; + } + + while (!feof (file)) + { + ptr_line = fgets (line, sizeof (line) - 1, file); + if (!ptr_line) + continue; + /* ignore comments */ + if (ptr_line[0] == '#') + continue; + /* execute command (if it's a valid command) */ + if (!weechat_string_input_for_buffer (ptr_line)) + { + /* remove trailing '\r' and '\n' */ + length = strlen (line) - 1; + while ((length >= 0) + && ((line[length] == '\n') + || (line[length] == '\r'))) + { + line[length] = '\0'; + length--; + } + weechat_command (NULL, ptr_line); + } + } + + fclose (file); + + free (filename2); + + return 1; +} + +/* * Refreshes the fset buffer after the change of an option. */ diff --git a/src/plugins/fset/fset-option.h b/src/plugins/fset/fset-option.h index 82be59c73..b8266274d 100644 --- a/src/plugins/fset/fset-option.h +++ b/src/plugins/fset/fset-option.h @@ -121,6 +121,7 @@ extern void fset_option_mark_options_matching_filter (const char *filter, int mark); extern void fset_option_unmark_all (); extern int fset_option_export (const char *filename, int with_help); +extern int fset_option_import (const char *filename); extern int fset_option_config_cb (const void *pointer, void *data, const char *option, |