diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2009-01-02 23:05:23 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2009-01-02 23:05:23 +0100 |
commit | e7e2da5a9c469aa4291d4630adb75d1e62cccbd5 (patch) | |
tree | 60a03d40f47c8ee7b44c0d50dcdb70224592cde2 | |
parent | e9b7d2bc465260a06142223968db674e028ce110 (diff) | |
download | weechat-e7e2da5a9c469aa4291d4630adb75d1e62cccbd5.zip |
Add null values for options, new syntax for /set, reintroduce temporary IRC server feature, improve IRC server options, new functions in API
60 files changed, 4505 insertions, 2831 deletions
diff --git a/doc/de/autogen/irc_commands.xml b/doc/de/autogen/irc_commands.xml index 6b47aef8d..cb2e942af 100644 --- a/doc/de/autogen/irc_commands.xml +++ b/doc/de/autogen/irc_commands.xml @@ -358,7 +358,7 @@ den Server dazu bringen, seine Konfigurationsdatei neu zu laden den Server dazu bringen, sich selbst neu zu starten </programlisting> -<command>/server [list [servername]] | [listfull [servername]] | [add servername hostname[/port] [-auto | -noauto] [-ipv6] [-ssl]] | [copy servername newservername] | [rename servername newservername] | [del servername] | [deloutq] | [switch]</command> +<command>/server [list [servername]] | [listfull [servername]] | [add servername hostname[/port] [-auto | -noauto] [-ipv6] [-ssl]] | [copy servername newservername] | [rename servername newservername] | [keep servername] | [del servername] | [deloutq] | [switch]</command> <programlisting> Auflisten, Hinzufügen oder Entfernen von Servern @@ -373,6 +373,7 @@ servername: server name, for internal and display use ssl: use SSL protocol copy: duplicate a server rename: rename a server + keep: keep server in config file (for temporary servers only) del: delete a server deloutq: delete messages out queue for all servers (all messages WeeChat is currently sending) switch: switch active server (when one buffer is used for all servers, default key: alt-s on server buffer) diff --git a/doc/de/autogen/logger_commands.xml b/doc/de/autogen/logger_commands.xml index a823d2b17..aa86e1426 100644 --- a/doc/de/autogen/logger_commands.xml +++ b/doc/de/autogen/logger_commands.xml @@ -24,11 +24,11 @@ Examples: /logger disable set level to 3 for all IRC buffers: - /set logger.level.irc = 3 + /set logger.level.irc 3 disable logging for main WeeChat buffer: - /set logger.level.core.weechat = 0 + /set logger.level.core.weechat 0 use a directory per IRC server and a file per channel inside: - /set logger.mask.irc = $server/$channel.weechatlog + /set logger.mask.irc "$server/$channel.weechatlog" Log levels used by IRC plugin: 1: user message, notice, private diff --git a/doc/de/autogen/weechat_commands.xml b/doc/de/autogen/weechat_commands.xml index 89dfc12fb..3bbe1cb37 100644 --- a/doc/de/autogen/weechat_commands.xml +++ b/doc/de/autogen/weechat_commands.xml @@ -242,12 +242,19 @@ file: configuration file to save Without argument, all files (WeeChat and plugins) are saved. </programlisting> -<command>/set [Option [ = Wert]]</command> +<command>/set [option [value]]</command> <programlisting> Konfigurationsparameter setzen option: name of an option - value: value for option + value: new value for option + +New value can be, according to variable type: + boolean: on, off ou toggle + integer: number, ++number ou --number string : any string ("" for empty string) + color : color name, ++number ou --number + +For all types, you can use null to remove option value (undefined value). This works only for some special plugin variables. </programlisting> <command>/unset [option]</command> diff --git a/doc/de/user/plugin_charset.de.xml b/doc/de/user/plugin_charset.de.xml index 83d366a8f..5ba83d67b 100644 --- a/doc/de/user/plugin_charset.de.xml +++ b/doc/de/user/plugin_charset.de.xml @@ -62,8 +62,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. festzulegen, benutzen Sie den <command>/set</command>" Befehl. Zum Beispiel: <screen> -/set charset.default.decode = ISO-8859-15 -/set charset.default.encode = ISO-8859-15 +/set charset.default.decode ISO-8859-15 +/set charset.default.encode ISO-8859-15 </screen> Wenn der Zeichensatz zum Dekodieren nicht gesetzt ist (z.B. beim ersten Start des Plugins), wird es automatisch auf den @@ -102,7 +102,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <!-- TRANSLATION NEEDED --> To set charset for all IRC channels (and privates) of an IRC server, use following command: - <screen>/set charset.decode.irc.freenode = ISO-8859-15</screen> + <screen>/set charset.decode.irc.freenode ISO-8859-15</screen> </para> </listitem> <listitem> @@ -141,7 +141,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <listitem> <para> Setze die globalen Dekodier-Einstellungen, z.B.: - <screen>/set charset.default.decode = ISO-8859-15</screen> + <screen>/set charset.default.decode ISO-8859-15</screen> </para> </listitem> </itemizedlist> diff --git a/doc/de/user/plugin_logger.de.xml b/doc/de/user/plugin_logger.de.xml index 41466bbd8..5302ca3b0 100644 --- a/doc/de/user/plugin_logger.de.xml +++ b/doc/de/user/plugin_logger.de.xml @@ -118,25 +118,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <listitem> <para> set level 3 for IRC channel #weechat: - <screen>/set logger.level.irc.freenode.#weechat = 3</screen> + <screen>/set logger.level.irc.freenode.#weechat 3</screen> </para> </listitem> <listitem> <para> set level 3 for freenode server buffer: - <screen>/set logger.level.irc.server.freenode = 3</screen> + <screen>/set logger.level.irc.server.freenode 3</screen> </para> </listitem> <listitem> <para> set level 3 for all channels on server freenode: - <screen>/set logger.level.irc.freenode = 3</screen> + <screen>/set logger.level.irc.freenode 3</screen> </para> </listitem> <listitem> <para> set level 2 for all IRC buffers: - <screen>/set logger.level.irc = 2</screen> + <screen>/set logger.level.irc 2</screen> </para> </listitem> </itemizedlist> @@ -156,7 +156,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <para> For example if you want one directory by IRC server and one file by channel inside: - <screen>/set logger.mask.irc = "irc/$server/$channel.weechatlog"</screen> + <screen>/set logger.mask.irc "irc/$server/$channel.weechatlog"</screen> You'll have following files: <screen> ~/.weechat/ diff --git a/doc/docgen.pl b/doc/docgen.pl index 4151a5b20..1c7dabc17 100644 --- a/doc/docgen.pl +++ b/doc/docgen.pl @@ -23,7 +23,7 @@ # 1. run WeeChat and load this script, with following command: # /perl load ~/src/weechat/doc/docgen.pl # 2. change path to build in your doc/ directory: -# /set plugins.var.perl.docgen.path = "~/src/weechat/doc" +# /set plugins.var.perl.docgen.path "~/src/weechat/doc" # 3. run docgen command: # /docgen # XML files should be in ~/src/weechat/doc/xx/autogen/ (where xx is language) diff --git a/doc/en/autogen/irc_commands.xml b/doc/en/autogen/irc_commands.xml index 638195a2a..31f267a24 100644 --- a/doc/en/autogen/irc_commands.xml +++ b/doc/en/autogen/irc_commands.xml @@ -358,7 +358,7 @@ tell the server to reload its config file tell the server to restart itself </programlisting> -<command>/server [list [servername]] | [listfull [servername]] | [add servername hostname[/port] [-auto | -noauto] [-ipv6] [-ssl]] | [copy servername newservername] | [rename servername newservername] | [del servername] | [deloutq] | [switch]</command> +<command>/server [list [servername]] | [listfull [servername]] | [add servername hostname[/port] [-auto | -noauto] [-ipv6] [-ssl]] | [copy servername newservername] | [rename servername newservername] | [keep servername] | [del servername] | [deloutq] | [switch]</command> <programlisting> list, add or remove servers @@ -373,6 +373,7 @@ servername: server name, for internal and display use ssl: use SSL protocol copy: duplicate a server rename: rename a server + keep: keep server in config file (for temporary servers only) del: delete a server deloutq: delete messages out queue for all servers (all messages WeeChat is currently sending) switch: switch active server (when one buffer is used for all servers, default key: alt-s on server buffer) diff --git a/doc/en/autogen/logger_commands.xml b/doc/en/autogen/logger_commands.xml index a823d2b17..aa86e1426 100644 --- a/doc/en/autogen/logger_commands.xml +++ b/doc/en/autogen/logger_commands.xml @@ -24,11 +24,11 @@ Examples: /logger disable set level to 3 for all IRC buffers: - /set logger.level.irc = 3 + /set logger.level.irc 3 disable logging for main WeeChat buffer: - /set logger.level.core.weechat = 0 + /set logger.level.core.weechat 0 use a directory per IRC server and a file per channel inside: - /set logger.mask.irc = $server/$channel.weechatlog + /set logger.mask.irc "$server/$channel.weechatlog" Log levels used by IRC plugin: 1: user message, notice, private diff --git a/doc/en/autogen/weechat_commands.xml b/doc/en/autogen/weechat_commands.xml index 366910d83..7b16eb04e 100644 --- a/doc/en/autogen/weechat_commands.xml +++ b/doc/en/autogen/weechat_commands.xml @@ -242,12 +242,19 @@ file: configuration file to save Without argument, all files (WeeChat and plugins) are saved. </programlisting> -<command>/set [option [ = value]]</command> +<command>/set [option [value]]</command> <programlisting> set config options option: name of an option - value: value for option + value: new value for option + +New value can be, according to variable type: + boolean: on, off ou toggle + integer: number, ++number ou --number string : any string ("" for empty string) + color : color name, ++number ou --number + +For all types, you can use null to remove option value (undefined value). This works only for some special plugin variables. </programlisting> <command>/unset [option]</command> diff --git a/doc/en/dev/plugin_c_api.en.xml b/doc/en/dev/plugin_c_api.en.xml index 6bf7f6b88..7e579789d 100644 --- a/doc/en/dev/plugin_c_api.en.xml +++ b/doc/en/dev/plugin_c_api.en.xml @@ -2944,6 +2944,7 @@ struct t_config_option *weechat_config_new_option ( int max, const chat *default_value, const char *value, + int null_value_allowed, int (*callback_check_value)(void *data, struct t_config_option *option, const char *value), @@ -3031,6 +3032,12 @@ struct t_config_option *weechat_config_new_option ( </listitem> <listitem> <para> + <option>null_value_allowed</option>: 1 if null (undefined value) + is allowed for option, otherwise 0 + </para> + </listitem> + <listitem> + <para> <option>callback_check_value</option>: callback called to check new value for an option (optional), arguments: <informaltable colsep="0" frame="none"> @@ -3159,6 +3166,7 @@ struct t_config_option *option1 = 0, 0, /* min, max */ "on", /* default */ "on", /* value */ + 0, /* null value allowed */ NULL, NULL, /* check callback */ NULL, NULL, /* change callback */ NULL, NULL); /* delete callback */ @@ -3171,6 +3179,7 @@ struct t_config_option *option2 = 0, 100, /* min, max */ "15", /* default */ "15", /* value */ + 0, /* null value allowed */ NULL, NULL, /* check callback */ NULL, NULL, /* change callback */ NULL, NULL); /* delete callback */ @@ -3183,6 +3192,7 @@ struct t_config_option *option3 = 0, 0, /* min, max */ "bottom", /* default */ "bottom", /* value */ + 0, /* null value allowed */ NULL, NULL, /* check callback */ NULL, NULL, /* change callback */ NULL, NULL); /* delete callback */ @@ -3195,6 +3205,7 @@ struct t_config_option *option4 = 0, 0, /* min, max */ "test", /* default */ "test", /* value */ + 1, /* null value allowed */ NULL, NULL, /* check callback */ NULL, NULL, /* change callback */ NULL, NULL); /* delete callback */ @@ -3207,6 +3218,7 @@ struct t_config_option *option5 = 0, 0, /* min, max */ "lightblue", /* default */ "lightblue", /* value */ + 0, /* null value allowed */ NULL, NULL, /* check callback */ NULL, NULL, /* change callback */ NULL, NULL); /* delete callback */ @@ -3487,6 +3499,66 @@ switch (weechat_config_option_set (option, "new_value", 1)) </para> </section> + <section id="secPluginCApi_weechat_config_option_set_null"> + <title>weechat_config_option_set_null</title> + + <para> + Prototype: +<programlisting> +int weechat_config_option_set_null ( + struct t_config_option *option, + int run_callback); +</programlisting> + </para> + <para> + Set null (undefined value) for an option. + </para> + <para> + Arguments: + <itemizedlist> + <listitem> + <para> + <option>option</option>: option pointer + </para> + </listitem> + <listitem> + <para> + <option>run_callback</option>: 1 for calling change callback if + option is changed (if it was not null), 0 otherwise + </para> + </listitem> + </itemizedlist> + </para> + <note> + <para> + You can set value to null only if option allows null value + (see <xref linkend="secPluginCApi_weechat_config_new_option" />). + </para> + </note> + <para> + Return value: WEECHAT_CONFIG_OPTION_SET_OK_CHANGED if option value has + been reset, WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE if value was not + changed, WEECHAT_CONFIG_OPTION_SET_ERROR if an error occured. + </para> + <para> + Example: +<screen> +switch (weechat_config_option_set_null (option, 1)) +{ + case WEECHAT_CONFIG_OPTION_SET_OK_CHANGED: + /* .... */ + break; + case WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE: + /* .... */ + break; + case WEECHAT_CONFIG_OPTION_SET_ERROR: + /* .... */ + break; +} +</screen> + </para> + </section> + <section id="secPluginCApi_weechat_config_option_unset"> <title>weechat_config_option_unset</title> @@ -3678,6 +3750,9 @@ void *weechat_config_option_get_pointer ( </itemizedlist> </para> <para> + Return value: pointer to property asked. + </para> + <para> Example: <screen> char *description = weechat_config_option_get_pointer (option, "description"); @@ -3685,6 +3760,43 @@ char *description = weechat_config_option_get_pointer (option, "description"); </para> </section> + <section id="secPluginCApi_weechat_config_option_is_null"> + <title>weechat_config_option_is_null</title> + + <para> + Prototype: +<programlisting> +int weechat_config_option_is_null (struct t_config_option *option); +</programlisting> + </para> + <para> + Check if an option is null (undefined value). + </para> + <para> + Arguments: + <itemizedlist> + <listitem> + <para> + <option>option</option>: option pointer + </para> + </listitem> + </itemizedlist> + </para> + <para> + Example: +<screen> +if (weechat_config_option_is_null (option)) +{ + /* value is null */ +} +else +{ + /* value is not null */ +} +</screen> + </para> + </section> + <section id="secPluginCApi_weechat_config_boolean"> <title>weechat_config_boolean</title> @@ -3725,6 +3837,46 @@ else </para> </section> + <section id="secPluginCApi_weechat_config_boolean_default"> + <title>weechat_config_boolean_default</title> + + <para> + Prototype: +<programlisting> +int weechat_config_boolean_default (struct t_config_option *option); +</programlisting> + </para> + <para> + Get default boolean value of option. + </para> + <para> + Arguments: + <itemizedlist> + <listitem> + <para> + <option>option</option>: option pointer + </para> + </listitem> + </itemizedlist> + </para> + <para> + Return value: default boolean value of option (0 or 1). + </para> + <para> + Example: +<screen> +if (weechat_config_boolean_default (option)) +{ + /* true */ +} +else +{ + /* false */ +} +</screen> + </para> + </section> + <section id="secPluginCApi_weechat_config_integer"> <title>weechat_config_integer</title> @@ -3752,7 +3904,38 @@ int weechat_config_integer (struct t_config_option *option); </para> <para> Example: - <screen>int value = weechat_config_boolean (option);</screen> + <screen>int value = weechat_config_integer (option);</screen> + </para> + </section> + + <section id="secPluginCApi_weechat_config_integer_default"> + <title>weechat_config_integer_default</title> + + <para> + Prototype: +<programlisting> +int weechat_config_integer_default (struct t_config_option *option); +</programlisting> + </para> + <para> + Get default integer value of option. + </para> + <para> + Arguments: + <itemizedlist> + <listitem> + <para> + <option>option</option>: option pointer + </para> + </listitem> + </itemizedlist> + </para> + <para> + Return value: default integer value of option. + </para> + <para> + Example: + <screen>int value = weechat_config_integer (option);</screen> </para> </section> @@ -3793,6 +3976,37 @@ const char *weechat_config_string (struct t_config_option *option); <para> Prototype: <programlisting> +const char *weechat_config_string_default (struct t_config_option *option); +</programlisting> + </para> + <para> + Get default string value of option. + </para> + <para> + Arguments: + <itemizedlist> + <listitem> + <para> + <option>option</option>: option pointer + </para> + </listitem> + </itemizedlist> + </para> + <para> + Return value: default string value of option. + </para> + <para> + Example: + <screen>char *value = weechat_config_string_default (option);</screen> + </para> + </section> + + <section id="secPluginCApi_weechat_config_color"> + <title>weechat_config_color</title> + + <para> + Prototype: +<programlisting> const char *weechat_config_color (struct t_config_option *option); </programlisting> </para> @@ -3818,6 +4032,85 @@ const char *weechat_config_color (struct t_config_option *option); </para> </section> + <section id="secPluginCApi_weechat_config_color_default"> + <title>weechat_config_color_default</title> + + <para> + Prototype: +<programlisting> +const char *weechat_config_color_default (struct t_config_option *option); +</programlisting> + </para> + <para> + Get default color value of option. + </para> + <para> + Arguments: + <itemizedlist> + <listitem> + <para> + <option>option</option>: option pointer + </para> + </listitem> + </itemizedlist> + </para> + <para> + Return value: default color value of option (string with name of color). + </para> + <para> + Example: + <screen>char *color = weechat_config_color_default (option);</screen> + </para> + </section> + + <section id="secPluginCApi_weechat_config_write_option"> + <title>weechat_config_write_option</title> + + <para> + Prototype: +<programlisting> +void weechat_config_write_option ( + struct t_config_file *config_file, + struct t_config_option *option); +</programlisting> + </para> + <para> + Write a line in a configuration file with option and its value (this + function should be called only in "write" or "write_default" callbacks + for a section). + </para> + <para> + Arguments: + <itemizedlist> + <listitem> + <para> + <option>config_file</option>: configuration file pointer + </para> + </listitem> + <listitem> + <para> + <option>option</option>: option pointer + </para> + </listitem> + </itemizedlist> + </para> + <para> + Example: +<screen> +int +my_section_write_cb (void *data, struct t_config_file *config_file, + const char *section_name) +{ + weechat_config_write_line (config_file, "my_section", NULL); + + weechat_config_write_option (config_file, option); + + return WEECHAT_RC_OK; +} +</screen> + </para> + </section> + <section id="secPluginCApi_weechat_config_write_line"> <title>weechat_config_write_line</title> @@ -3854,6 +4147,12 @@ void weechat_config_write_line ( </listitem> </itemizedlist> </para> + <note> + <para> + If value is NULL, then line with section name is written + (for example: "[section]"). + </para> + </note> <para> Example: <screen> @@ -3861,6 +4160,8 @@ int my_section_write_cb (void *data, struct t_config_file *config_file, const char *section_name) { + weechat_config_write_line (config_file, "my_section", NULL); + weechat_config_write_line (config_file, "option", "%s;%d", "value", 123); diff --git a/doc/en/user/plugin_charset.en.xml b/doc/en/user/plugin_charset.en.xml index 9cddb50df..3946d9f21 100644 --- a/doc/en/user/plugin_charset.en.xml +++ b/doc/en/user/plugin_charset.en.xml @@ -63,8 +63,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <command>/set</command>. For example: <screen> -/set charset.default.decode = ISO-8859-15 -/set charset.default.encode = ISO-8859-15 +/set charset.default.decode ISO-8859-15 +/set charset.default.encode ISO-8859-15 </screen> If global decode charset is not set (for example during first load of Charset plugin), it will be automatically set to terminal @@ -99,7 +99,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <para> To set charset for all IRC channels (and privates) of an IRC server, use following command: - <screen>/set charset.decode.irc.freenode = ISO-8859-15</screen> + <screen>/set charset.decode.irc.freenode ISO-8859-15</screen> </para> </listitem> <listitem> @@ -145,7 +145,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <listitem> <para> setup global decode value, for example: - <screen>/set charset.default.decode = ISO-8859-15</screen> + <screen>/set charset.default.decode ISO-8859-15</screen> </para> </listitem> </itemizedlist> diff --git a/doc/en/user/plugin_logger.en.xml b/doc/en/user/plugin_logger.en.xml index 06dfe8ae2..186b660a7 100644 --- a/doc/en/user/plugin_logger.en.xml +++ b/doc/en/user/plugin_logger.en.xml @@ -118,25 +118,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <listitem> <para> set level 3 for IRC channel #weechat: - <screen>/set logger.level.irc.freenode.#weechat = 3</screen> + <screen>/set logger.level.irc.freenode.#weechat 3</screen> </para> </listitem> <listitem> <para> set level 3 for freenode server buffer: - <screen>/set logger.level.irc.server.freenode = 3</screen> + <screen>/set logger.level.irc.server.freenode 3</screen> </para> </listitem> <listitem> <para> set level 3 for all channels on server freenode: - <screen>/set logger.level.irc.freenode = 3</screen> + <screen>/set logger.level.irc.freenode 3</screen> </para> </listitem> <listitem> <para> set level 2 for all IRC buffers: - <screen>/set logger.level.irc = 2</screen> + <screen>/set logger.level.irc 2</screen> </para> </listitem> </itemizedlist> @@ -156,7 +156,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <para> For example if you want one directory by IRC server and one file by channel inside: - <screen>/set logger.mask.irc = "irc/$server/$channel.weechatlog"</screen> + <screen>/set logger.mask.irc "irc/$server/$channel.weechatlog"</screen> You'll have following files: <screen> ~/.weechat/ diff --git a/doc/en/weechat_quickstart.en.txt b/doc/en/weechat_quickstart.en.txt index 6e00e7360..dc2429561 100644 --- a/doc/en/weechat_quickstart.en.txt +++ b/doc/en/weechat_quickstart.en.txt @@ -3,17 +3,17 @@ WeeChat quick start guide (english version) 1. Launch weechat - Run "weechat-curses" from your shell. - A recommended terminal emulator for X (but not mandatory) is rxvt-unicode (it has good UTF-8 support, and no problem with default keyboard bindings). + Run "weechat-curses" from your shell. + 2. Online help / options WeeChat has help for all commands, just issue /help To get help on a command, issue /help command - To set options, use /set config.section.option = value + To set options, use /set config.section.option value (where config is configuration name ("weechat" for core, or a plugin name), "section" the section of this configuration and "option" the option name). @@ -24,12 +24,14 @@ WeeChat quick start guide (english version) You can use /set option with partial name and wildcard "*" at beginning or end to display all options containg letters. For example: - /set => display all options (WeeChat and plugins) - /set weechat.* => display WeeChat options - /set irc.* => display IRC plugin options + + /set => display all options (WeeChat and plugins) + /set weechat.* => display WeeChat options + /set irc.* => display IRC plugin options You can display help for an option with /help, for example: - /help weechat.look.highlight + + /help weechat.look.highlight All settings are saved when WeeChat ends (or with "/save" command to force write of options). @@ -51,10 +53,12 @@ WeeChat quick start guide (english version) 4. Create an IRC server You can add an IRC server with /server command, for example: - /server add oftc irc.oftc.org 6667 + + /server add oftc irc.oftc.org 6667 As usual, help is available if you're lost: - /help server + + /help server 5. Set custom IRC server options @@ -62,30 +66,44 @@ WeeChat quick start guide (english version) don't specify a specific value for a server option. These default options are "irc.server_default.*". + For each server option, WeeChat uses its value if it is defined (not + "null"). Otherwise WeeChat uses default value (irc.server_default.xxx). + For example there's default nicks (based on your un*x login), and you can override them for oftc server with following command: - /set irc.server.oftc.nicks = "mynick1,mynick2,mynick3,mynick4,mynick5" + + /set irc.server.oftc.nicks "mynick1,mynick2,mynick3,mynick4,mynick5" To set username and realname: - /set irc.server.oftc.username = "My user name" - /set irc.server.oftc.realname = "My real name" + + /set irc.server.oftc.username "My user name" + /set irc.server.oftc.realname "My real name" To enable auto-connect to server at startup: - /set irc.server.oftc.autoconnect = on + + /set irc.server.oftc.autoconnect on To run a command after connection to server, for example to identify with nickserv: - /set irc.server.oftc.command = "/msg nickserv identify xxxxxx" + + /set irc.server.oftc.command "/msg nickserv identify xxxxxx" + Note: many commmands can be separated by ';' (semi-colon) To auto-join some channels when connecting to server: - /set irc.server.oftc.autojoin = "#channel1,#channel2" + + /set irc.server.oftc.autojoin "#channel1,#channel2" + + To remove value of a server option, and use default value instead, + for example to use default nicks (irc.server_default.nicks): + + /set irc.server.oftc.nicks null Other options: - You can setup other options with following command: - /set irc.server.oftc.xxx = value - where "xxx" is option name - you can see all possible options with: - /set irc.server_default.* + You can setup other options with following command ("xxx" is option + name): + + /set irc.server.oftc.xxx value 6. Connect to IRC server and auto-join channels @@ -98,11 +116,17 @@ WeeChat quick start guide (english version) 7. Join/part IRC channels Join a channel: - /join #channel + + /join #channel + Part a channel: - /part [quit message] + + /part [quit message] + Close server or channel buffer: - /close [quit message] + + /close [quit message] + (/close is an alias on /buffer close) 8. Buffer/window management @@ -115,13 +139,16 @@ WeeChat quick start guide (english version) with many buffers at same time. Commands to manage buffers and windows: - /buffer - /window + + /buffer + /window + (I'll not repeat here that you can get help with /help on these commands) For example, to split verticaly screen into a small window (1/3 width), and a large (2/3), use command: - /window splitv 33 + + /window splitv 33 9. Key bindings @@ -140,11 +167,16 @@ WeeChat quick start guide (english version) A useful key is meta-k (alt-k) to find key codes. For example, to bind meta-y (alt-y) to command "/buffer close": - /key (press meta-k) (press meta-y) /buffer close + + /key (press meta-k) (press meta-y) /buffer close + You'll have a command line like: - /key meta-y /buffer close + + /key meta-y /buffer close + To remove key: - /key unbind meta-y + + /key unbind meta-y 10. Plugins/scripts @@ -153,24 +185,26 @@ WeeChat quick start guide (english version) Plugins are automatically loaded when found. Some plugins let you use scripts in WeeChat (in many languages like Perl, - Python, Ruby and Lua). These plugins must be loaded with /plugin command - and they provide commands like /perl, used to load scripts. + Python, Ruby, Lua and Tcl). These plugins must be loaded with /plugin + command and they provide commands like /perl, used to load scripts. Many external plugins/scripts (from contributors) are available for WeeChat, please look at: - http://weechat.flashtux.org/plugins.php + + http://weechat.flashtux.org/plugins.php Please look at WeeChat documentation to load/unload plugins or scripts. 11. More documentation You can now use WeeChat and read FAQ/documentation for any other question: - http://weechat.flashtux.org/faq.php - http://weechat.flashtux.org/doc.php + + http://weechat.flashtux.org/faq.php + http://weechat.flashtux.org/doc.php Enjoy WeeChat! -- -(c) 2006-2008, written by FlashCode <flashcode@flashtux.org> -Last edited on 2008-11-12. +(c) 2006-2009, written by FlashCode <flashcode@flashtux.org> +Last edited on 2009-01-02. This document is part of WeeChat and is distributed under GPL 3 licence. diff --git a/doc/fr/autogen/irc_commands.xml b/doc/fr/autogen/irc_commands.xml index 209ddde24..fac5e1441 100644 --- a/doc/fr/autogen/irc_commands.xml +++ b/doc/fr/autogen/irc_commands.xml @@ -358,7 +358,7 @@ demander au serveur de recharger son fichier de configuration demander au serveur de redémarrer </programlisting> -<command>/server [list [nom_serveur]] | [listfull [nom_serveur]] | [add nom_serveur nom[/port] [-temp] [-auto | -noauto] [-ipv6] [-ssl]] | [copy nom_serveur nouveau_nom_serveur] | [rename nom_serveur nouveau_nom_serveur] | [del nom_serveur] | [deloutq] | [switch]</command> +<command>/server [list [nom_serveur]] | [listfull [nom_serveur]] | [add nom_serveur nom[/port] [-temp] [-auto | -noauto] [-ipv6] [-ssl]] | [copy nom_serveur nouveau_nom_serveur] | [rename nom_serveur nouveau_nom_serveur] | [keep nom_serveur] | [del nom_serveur] | [deloutq] | [switch]</command> <programlisting> liste, ajoute ou retire des serveurs @@ -373,6 +373,7 @@ nom_serveur: nom du serveur, pour usage interne et affichage ssl: utiliser le protocole SSL copy: dupliquer un serveur rename: renommer un serveur + keep: garder le serveur dans le fichier de configuration (pour les serveurs temporaires seulement) del: supprimer un serveur deloutq: supprimer la file d'attente des messages sortants pour tous les serveurs (tous les messages que WeeChat est actuellement en train d'envoyer) switch: changer le serveur actif (quand un tampon est utilisé pour tous les serveurs, touche par défaut: alt-s sur le tampon serveur) diff --git a/doc/fr/autogen/logger_commands.xml b/doc/fr/autogen/logger_commands.xml index bcd744d90..67c393535 100644 --- a/doc/fr/autogen/logger_commands.xml +++ b/doc/fr/autogen/logger_commands.xml @@ -23,11 +23,11 @@ Exemples : désactiver l'enregistrement pour le tampon courant : /logger disable définir le niveau à 3 pour les tampons IRC : - /set logger.level.irc = 3 + /set logger.level.irc 3 désactiver l'enregistrement pour le tampon principal de WeeChat : - /set logger.level.core.weechat = 0 + /set logger.level.core.weechat 0 utiliser un répertoire par serveur IRC et un fichier par canal dedans : - /set logger.mask.irc = $server/$channel.weechatlog + /set logger.mask.irc "$server/$channel.weechatlog" Niveaux de log utilisés par l'extension IRC : 1: message d'utilisateur, notice, privé diff --git a/doc/fr/autogen/weechat_commands.xml b/doc/fr/autogen/weechat_commands.xml index 6324a5dfc..ff696ee2a 100644 --- a/doc/fr/autogen/weechat_commands.xml +++ b/doc/fr/autogen/weechat_commands.xml @@ -240,12 +240,20 @@ fichier: fichier de configuration à sauvegarder Sans paramètre, tous les fichiers (WeeChat et extensions) sont sauvegardés. </programlisting> -<command>/set [option [ = valeur]]</command> +<command>/set [option [valeur]]</command> <programlisting> modifier des options de configuration option: nom d'une option -valeur: valeur pour l'option +valeur: nouvelle valeur pour l'option + +La nouvelle valeur peut être, selon le type de l'option : + booléen: on, off ou toggle + entier : nombre, ++nombre ou --nombre + chaîne : toute chaîne ("" pour une chaîne vide) + couleur: nom de couleur, ++nombre ou --nombre + +Pour tous les types, vous pouvez utiliser null pour supprimer la valeur de l'option (valeur non définie). Cela ne fonctionne qu'avec certaines options spéciales des extensions. </programlisting> <command>/unset [option]</command> diff --git a/doc/fr/user/plugin_charset.fr.xml b/doc/fr/user/plugin_charset.fr.xml index e4e0f0a29..d6d3d0a29 100644 --- a/doc/fr/user/plugin_charset.fr.xml +++ b/doc/fr/user/plugin_charset.fr.xml @@ -66,11 +66,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <listitem> <para> Pour modifier les jeux de caractères de décodage et d'encodage - globaux, utilisez la commande <command>/setp</command>". + globaux, utilisez la commande <command>/set</command>". Par exemple : <screen> -/set charset.default.decode = ISO-8859-15 -/set charset.default.encode = ISO-8859-15 +/set charset.default.decode ISO-8859-15 +/set charset.default.encode ISO-8859-15 </screen> Si le jeu de caractères de décodage global n'est pas renseigné (par exemple pendant le premier chargement de Charset), il sera @@ -108,7 +108,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. Pour modifier le jeu de caractères pour tous les canaux IRC (et conversations privées) d'un serveur IRC, utilisez la commande suivante : - <screen>/set charset.decode.irc.freenode = ISO-8859-15</screen> + <screen>/set charset.decode.irc.freenode ISO-8859-15</screen> </para> </listitem> <listitem> @@ -158,7 +158,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <listitem> <para> affectez la valeur pour le décodage global, par exemple : - <screen>/set charset.default.decode = ISO-8859-15</screen> + <screen>/set charset.default.decode ISO-8859-15</screen> </para> </listitem> </itemizedlist> diff --git a/doc/fr/user/plugin_logger.fr.xml b/doc/fr/user/plugin_logger.fr.xml index c77cb41d4..38ef23ae6 100644 --- a/doc/fr/user/plugin_logger.fr.xml +++ b/doc/fr/user/plugin_logger.fr.xml @@ -119,25 +119,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <listitem> <para> afecter le niveau 3 pour le canal IRC #weechat : - <screen>/set logger.level.irc.freenode.#weechat = 3</screen> + <screen>/set logger.level.irc.freenode.#weechat 3</screen> </para> </listitem> <listitem> <para> affecter le niveau 3 pour le tampon serveur freenode : - <screen>/set logger.level.irc.server.freenode = 3</screen> + <screen>/set logger.level.irc.server.freenode 3</screen> </para> </listitem> <listitem> <para> affecter le niveau 3 pour tous les canaux sur le serveur freenode : - <screen>/set logger.level.irc.freenode = 3</screen> + <screen>/set logger.level.irc.freenode 3</screen> </para> </listitem> <listitem> <para> affecter le niveau 2 pour tous les tampons IRC : - <screen>/set logger.level.irc = 2</screen> + <screen>/set logger.level.irc 2</screen> </para> </listitem> </itemizedlist> @@ -158,7 +158,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. <para> Par exemple, si vous voulez un répertoire par serveur IRC et un fichier par canal dedans : - <screen>/set logger.mask.irc = "irc/$server/$channel.weechatlog"</screen> + <screen>/set logger.mask.irc "irc/$server/$channel.weechatlog"</screen> Vous obtiendrez les fichiers suivants : <screen> ~/.weechat/ diff --git a/doc/fr/weechat_quickstart.fr.txt b/doc/fr/weechat_quickstart.fr.txt index f99003e0f..5314e82e4 100644 --- a/doc/fr/weechat_quickstart.fr.txt +++ b/doc/fr/weechat_quickstart.fr.txt @@ -3,18 +3,18 @@ Guide de démarrage rapide WeeChat (version française) 1. Démarrer weechat - Lancer "weechat-curses" depuis votre shell. - Un émulateur de terminal recommandé pour X (mais pas obligatoire) est rxvt-unicode (il a un bon support UTF-8, et aucun problème avec les touches par défaut). + Lancer "weechat-curses" depuis votre shell. + 2. Aide en ligne / options WeeChat dispose d'aide pour toutes les commandes, tapez simplement /help Pour avoir de l'aide sur une commande, tapez /help commande - Pour modifier des options, utilisez /set config.section.option = valeur + Pour modifier des options, utilisez /set config.section.option valeur (où "config" est le nom de la configuration ("weechat" pour le coeur, ou un nom d'extension), "section" la section de cette configuration et "option" le nom de l'option). @@ -26,12 +26,13 @@ Guide de démarrage rapide WeeChat (version française) joker "*" au début ou à la fin pour afficher toutes les options contenant ces lettres. Par exemple : - /set => affiche toutes les options (WeeChat et extensions) - /set weechat.* => affiche les options WeeChat - /set irc.* => affiche les options de l'extension IRC + + /set => affiche toutes les options (WeeChat et extensions) + /set weechat.* => affiche les options WeeChat + /set irc.* => affiche les options de l'extension IRC Vous pouvez afficher de l'aide sur une option avec /help, par exemple : - /help weechat.look.highlight + /help weechat.look.highlight Toutes les options sont sauvées quand WeeChat quitte (ou avec la commande "/save" pour forcer une écriture des options). @@ -55,10 +56,12 @@ Guide de démarrage rapide WeeChat (version française) 4. Créer un serveur IRC Vous pouvez ajouter un serveur IRC par la commande /server, par exemple : - /server add oftc irc.oftc.org 6667 + + /server add oftc irc.oftc.org 6667 Comme d'habitude, de l'aide est disponible si vous êtes perdus : - /help server + + /help server 5. Définir les options du serveur IRC @@ -66,31 +69,46 @@ Guide de démarrage rapide WeeChat (version française) spécifiez pas de valeur spécifique pour une option de serveur. Ces options par défaut sont "irc.server_default.*". + Pour chaque option d'un serveur, WeeChat utilise sa valeur si elle est + définie (non "null"). Sinon WeeChat utilise la valeur par défaut + (irc.server_default.xxx). + Par exemple il y a des pseudos par défaut (basés sur votre login un*x), et vous pouvez les écraser pour le serveur oftc avec la commande suivante : - /set irc.server.oftc.nicks = "pseudo1,pseudo2,pseudo3,pseudo4,pseudo5" + + /set irc.server.oftc.nicks "pseudo1,pseudo2,pseudo3,pseudo4,pseudo5" Pour modifier le nom d'utilisateur et nom réel : - /set irc.server.oftc.username = "Mon nom d'utilisateur" - /set irc.server.oftc.realname = "Mon nom réel" + + /set irc.server.oftc.username "Mon nom d'utilisateur" + /set irc.server.oftc.realname "Mon nom réel" Pour activer la connexion automatique au serveur lors du démarrage : - /set irc.server.oftc.autoconnect = on + + /set irc.server.oftc.autoconnect on Pour lancer une commande après connexion au serveur, par exemple pour s'identifier auprès de nickserv : - /set irc.server.oftc.command = "/msg nickserv identify xxxxxx" + + /set irc.server.oftc.command "/msg nickserv identify xxxxxx" + NB: plusieurs commandes peuvent être séparées par ';' (point-virgule) Pour rejoindre automatiquement des canaux lors de la connexion au serveur : - /set irc.server.oftc.autojoin = "#canal1,#canal2" + + /set irc.server.oftc.autojoin "#canal1,#canal2" + + Pour supprimer la valeur d'une option du serveur et utiliser sa valeur par + défaut à la place, par exemple pour utiliser les pseudos par défaut + (irc.server_default.nicks) : + + /set irc.server.oftc.nicks null Autres options : - Vous pouvez modifier les autres options avec la commande suivante : - /set irc.server.oftc.xxx = valeur - où "xxx" est le nom d'une option - vous pouvez vois les options possibles - avec : - /set irc.server_default.* + Vous pouvez modifier les autres options avec la commande suivante ("xxx" + est le nom d'une option) : + + /set irc.server.oftc.xxx valeur 6. Se connecter au serveur IRC et rejoindre les canaux @@ -103,11 +121,17 @@ Guide de démarrage rapide WeeChat (version française) 7. Joindre/quitter les canaux IRC Joindre un canal : - /join #channel + + /join #channel + Quitter un canal : - /part [message de fin] + + /part [message de fin] + Quitter un canal et fermer le tampon : - /close [message de fin] + + /close [message de fin] + (/close est un alias sur /buffer close) 8. Gérer les tampons/fenêtres @@ -120,14 +144,17 @@ Guide de démarrage rapide WeeChat (version française) alors plusieurs fenêtres avec plusieurs tampons en même temps. Commandes pour gérer les tampons et les fenêtres : - /buffer - /window + + /buffer + /window + (je ne répéterai pas que vous pouvez avoir de l'aide sur ces commandes avec /help) Par exemple, pour découper verticalement l'écran en une petite fenêtre (1/3 de la largeur) et une large (2/3), utilisez la commande : - /window splitv 33 + + /window splitv 33 9. Raccourcis clavier @@ -147,11 +174,16 @@ Guide de démarrage rapide WeeChat (version française) Une touche utile est meta-k (alt-k) pour trouver le code des touches. Par exemple, pour associer meta-y (alt-y) à la commande "/buffer close" : - /key (pressez meta-k) (pressez meta-y) /buffer close + + /key (pressez meta-k) (pressez meta-y) /buffer close + Vous aurez une ligne de commande qui ressemble à ceci : - /key meta-y /buffer close + + /key meta-y /buffer close + Pour enlever la touche : - /key unbind meta-y + + /key unbind meta-y 10. Extensions/scripts @@ -160,13 +192,14 @@ Guide de démarrage rapide WeeChat (version française) Les extensions sont automatiquement chargées lorsqu'elles sont trouvées. Des extensions permettent d'utiliser des scripts dans WeeChat (dans - différent langages comme Perl, Python, Ruby et Lua). Ces extensions + différent langages comme Perl, Python, Ruby, Lua et Tcl). Ces extensions doivent être chargées avec la commande /plugin et elles fournissent des commandes telles que /perl, utilisées pour charger les scripts. Plusieurs extensions/scripts (de contributeurs) sont disponibles pour WeeChat, voir ici : - http://weechat.flashtux.org/plugins.php + + http://weechat.flashtux.org/plugins.php Merci de regarder la documentation WeeChat pour charger/décharger des extensions ou des scripts. @@ -175,12 +208,13 @@ Guide de démarrage rapide WeeChat (version française) Vous pouvez maintenant utiliser WeeChat et lire la FAQ/documentation pour toute autre question : - http://weechat.flashtux.org/faq.php - http://weechat.flashtux.org/doc.php + + http://weechat.flashtux.org/faq.php + http://weechat.flashtux.org/doc.php Bon WeeChat ! -- -(c) 2006-2008, écrit par FlashCode <flashcode@flashtux.org> -Dernière édition le 12/11/2008. +(c) 2006-2009, écrit par FlashCode <flashcode@flashtux.org> +Dernière édition le 02/01/2009. Ce document fait partie de WeeChat et est distribué sous license GPL 3. @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 18:36+0100\n" +"POT-Creation-Date: 2009-01-02 22:40+0100\n" "PO-Revision-Date: 2008-09-17 16:19+0200\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -321,6 +321,10 @@ msgstr "hodnoty" msgid "default value" msgstr "výchozí hodnota" +#, fuzzy +msgid "(undefined)" +msgstr "výchozí hodnota" + msgid "current value" msgstr "aktuální hodnota" @@ -1074,15 +1078,23 @@ msgstr "" msgid "set config options" msgstr "nastaví konfigurační možnosti" -msgid "[option [ = value]]" +#, fuzzy +msgid "[option [value]]" msgstr "[možnost [ = hodnota]]" msgid "" "option: name of an option\n" -" value: value for option" +" value: new value for option\n" +"\n" +"New value can be, according to variable type:\n" +" boolean: on, off ou toggle\n" +" integer: number, ++number ou --number string : any string (\"\" for empty " +"string)\n" +" color : color name, ++number ou --number\n" +"\n" +"For all types, you can use null to remove option value (undefined value). " +"This works only for some special plugin variables." msgstr "" -"možnost: jméno volby\n" -"hodnota: hodnota volby" msgid "unset/reset config options" msgstr "odnastavit/resetovat konfigurační možnosti" @@ -1680,7 +1692,7 @@ msgid "(default options)" msgstr "(výchozí volby)" #, fuzzy, c-format -msgid "%sWarning: config file \"%s\" not found" +msgid "%sWarning: configuration file \"%s\" not found" msgstr "%s konfigurační soubor \"%s\" nenalezen\n" #, fuzzy, c-format @@ -1696,10 +1708,6 @@ msgid "%sWarning: %s, line %d: unknown section identifier (\"%s\")" msgstr "%s %s, řádek %d: neznámý identifikátor sekce (\"%s\")\n" #, fuzzy, c-format -msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" -msgstr "%s %s, řádek %d: nevalidní syntax, chybí \"=\"\n" - -#, fuzzy, c-format msgid "%sWarning: %s, line %d: option \"%s\" unknown for section \"%s\"" msgstr "%s %s, řádek %d: neznámý identifikátor sekce (\"%s\")\n" @@ -1715,58 +1723,6 @@ msgstr "%s %s, řádek %d: nevalidní volba \"%s\"\n" msgid "Reloading configuration file %s" msgstr "Ukládám konfiguraci na disk\n" -msgid " . type: boolean\n" -msgstr " . typ: boolean\n" - -#, fuzzy -msgid " . values: \"on\" or \"off\"\n" -msgstr " . hodnoty: 'on' or 'off'\n" - -#, fuzzy, c-format -msgid " . default value: \"%s\"\n" -msgstr " . výchozí hodnota: '%s'\n" - -msgid " . type: string\n" -msgstr " . typ: řetězec\n" - -msgid " . values: " -msgstr " . hodnoty: " - -msgid " . type: integer\n" -msgstr " . typ: celočíselný\n" - -#, c-format -msgid " . values: between %d and %d\n" -msgstr " . hodnoty: mezi %d a %d\n" - -#, c-format -msgid " . default value: %d\n" -msgstr " . výchozí hodnota: %d\n" - -msgid " . values: any string\n" -msgstr " . hodnoty: typ řetězec (jakýkoliv řetězec)\n" - -msgid " . type: char\n" -msgstr " . typ: znak\n" - -msgid " . values: any char\n" -msgstr " . hodnoty: jakýkolív znak\n" - -#, c-format -msgid " . values: any string (limit: %d chars)\n" -msgstr " . hodnoty: jakýkoliv řetězec (limit: %d znaků)\n" - -msgid " . type: color\n" -msgstr " . typ: barva\n" - -#, fuzzy -msgid " . values: color (depends on GUI used)\n" -msgstr " . hodnoty: mezi %d a %d\n" - -#, c-format -msgid " . description: %s\n" -msgstr " . popis: %s\n" - #, c-format msgid "System clock skew detected (%+ld seconds), reinitializing all timers" msgstr "" @@ -2417,7 +2373,7 @@ msgid "%s%s: missing argument for \"%s\" option" msgstr "%s chybí argument pro volbu \"%s\"\n" #, fuzzy, c-format -msgid "%s: server %s%s%s created" +msgid "%s: server %s%s%s created (temporary server, NOT SAVED!)" msgstr "Server %s%s%s vytvořen\n" #, fuzzy, c-format @@ -2528,6 +2484,18 @@ msgid "No server found with \"%s\"" msgstr "Žádný server s '%s' nenalezen.\n" #, fuzzy, c-format +msgid "%s%s: server \"%s\" already exists, can't create it!" +msgstr "%s server \"%s\" již existuje, nemohu jej vytvořít!\n" + +#, fuzzy, c-format +msgid "%s%s: unable to create server" +msgstr "%s nemohu vytvořit server\n" + +#, fuzzy, c-format +msgid "%s: server %s%s%s created" +msgstr "Server %s%s%s vytvořen\n" + +#, fuzzy, c-format msgid "%s%s: server \"%s\" not found for \"%s\" command" msgstr "%s server \"%s\" nenalezen pro příkaz \"%s\"\n" @@ -2536,20 +2504,20 @@ msgid "%s%s: server \"%s\" already exists for \"%s\" command" msgstr "%s server \"%s\" pro příkaz \"%s\" již existuje\n" #, fuzzy, c-format -msgid "%s: server %s%s%s has been renamed to %s%s" -msgstr "Server %s%s%s byl přejmenován na %s%s\n" +msgid "%s: server %s%s%s has been copied to %s%s" +msgstr "Server %s%s%s byl zkopírován do %s%s\n" #, fuzzy, c-format -msgid "%s%s: server \"%s\" already exists, can't create it!" -msgstr "%s server \"%s\" již existuje, nemohu jej vytvořít!\n" +msgid "%s: server %s%s%s has been renamed to %s%s" +msgstr "Server %s%s%s byl přejmenován na %s%s\n" #, fuzzy, c-format -msgid "%s%s: unable to create server" -msgstr "%s nemohu vytvořit server\n" +msgid "%s%s: server \"%s\" is not a temporary server" +msgstr "Server %s%s%s vytvořen\n" #, fuzzy, c-format -msgid "%s: server %s%s%s has been copied to %s%s" -msgstr "Server %s%s%s byl zkopírován do %s%s\n" +msgid "%s: server %s%s%s is not temporary any more" +msgstr "Server %s%s%s vytvořen\n" #, fuzzy, c-format msgid "" @@ -3108,7 +3076,8 @@ msgstr "vypíše, přídá nebo odebere servery" msgid "" "[list [servername]] | [listfull [servername]] | [add servername hostname[/" "port] [-auto | -noauto] [-ipv6] [-ssl]] | [copy servername newservername] | " -"[rename servername newservername] | [del servername] | [deloutq] | [switch]" +"[rename servername newservername] | [keep servername] | [del servername] | " +"[deloutq] | [switch]" msgstr "" "[list [jméno_serveru]] | [listfull [jméno_serveru]] | [add jméno_serveru " "jméno_hosta [-port port] [-temp] [-auto | -noauto] [-ipv6] [-ssl] [-pwd " @@ -3132,6 +3101,7 @@ msgid "" " ssl: use SSL protocol\n" " copy: duplicate a server\n" " rename: rename a server\n" +" keep: keep server in config file (for temporary servers only)\n" " del: delete a server\n" " deloutq: delete messages out queue for all servers (all messages WeeChat " "is currently sending)\n" @@ -3364,14 +3334,6 @@ msgstr "" msgid "%sirc: too few arguments for \"%s\" command" msgstr "%s špatné parametry pro příkaz \"%s\"\n" -#, fuzzy, c-format -msgid "%s%s: error creating server \"%s\"" -msgstr "%s nedostatek paměti pro infobar zprávu\n" - -#, fuzzy, c-format -msgid "%s%s: error creating option \"%s\" for server \"%s\" (server not found)" -msgstr "%s volba nastavení \"%s\" nenalezena\n" - #, c-format msgid "" "%s%s: warning: server \"%s\" not found in configuration file, not deleted in " @@ -3450,6 +3412,10 @@ msgid "automatically rejoin channels when kicked" msgstr "automaticky znovu přijít na kanál po vykopnutí" #, fuzzy, c-format +msgid "%s%s: error creating server \"%s\"" +msgstr "%s nedostatek paměti pro infobar zprávu\n" + +#, fuzzy, c-format msgid "%s%s: error creating server option \"%s\"" msgstr "%s nedostatek paměti pro infobar zprávu\n" @@ -3574,7 +3540,7 @@ msgid "IRC debug messages" msgstr "vypsat debug zprávy" #, fuzzy, c-format -msgid "%sServer: %s%s %s[%s%s%s]" +msgid "%sServer: %s%s %s[%s%s%s]%s%s" msgstr "%sServer: %s%s %s[%s%s%s]\n" msgid "connected" @@ -3583,6 +3549,9 @@ msgstr "připojen" msgid "not connected" msgstr "nepřipojen" +msgid " (temporary)" +msgstr "" + msgid "on" msgstr "na" @@ -4170,11 +4139,11 @@ msgid "" " /logger disable\n" "\n" " set level to 3 for all IRC buffers:\n" -" /set logger.level.irc = 3\n" +" /set logger.level.irc 3\n" " disable logging for main WeeChat buffer:\n" -" /set logger.level.core.weechat = 0\n" +" /set logger.level.core.weechat 0\n" " use a directory per IRC server and a file per channel inside:\n" -" /set logger.mask.irc = $server/$channel.weechatlog\n" +" /set logger.mask.irc \"$server/$channel.weechatlog\"\n" "\n" "Log levels used by IRC plugin:\n" " 1: user message, notice, private\n" @@ -5136,6 +5105,78 @@ msgstr "%s DCC: nemohu nastavit 'neblokovaci' volbu na soket\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s chybí argument pro volbu \"%s\"\n" +#~ msgid " . type: boolean\n" +#~ msgstr " . typ: boolean\n" + +#, fuzzy +#~ msgid " . values: \"on\" or \"off\"\n" +#~ msgstr " . hodnoty: 'on' or 'off'\n" + +#, fuzzy +#~ msgid " . default value: \"%s\"\n" +#~ msgstr " . výchozí hodnota: '%s'\n" + +#~ msgid " . type: string\n" +#~ msgstr " . typ: řetězec\n" + +#~ msgid " . values: " +#~ msgstr " . hodnoty: " + +#~ msgid " . type: integer\n" +#~ msgstr " . typ: celočíselný\n" + +#~ msgid " . values: between %d and %d\n" +#~ msgstr " . hodnoty: mezi %d a %d\n" + +#~ msgid " . default value: %d\n" +#~ msgstr " . výchozí hodnota: %d\n" + +#~ msgid " . values: any string\n" +#~ msgstr " . hodnoty: typ řetězec (jakýkoliv řetězec)\n" + +#~ msgid " . type: char\n" +#~ msgstr " . typ: znak\n" + +#~ msgid " . values: any char\n" +#~ msgstr " . hodnoty: jakýkolív znak\n" + +#~ msgid " . values: any string (limit: %d chars)\n" +#~ msgstr " . hodnoty: jakýkoliv řetězec (limit: %d znaků)\n" + +#~ msgid " . type: color\n" +#~ msgstr " . typ: barva\n" + +#, fuzzy +#~ msgid " . values: color (depends on GUI used)\n" +#~ msgstr " . hodnoty: mezi %d a %d\n" + +#~ msgid " . description: %s\n" +#~ msgstr " . popis: %s\n" + +#, fuzzy +#~ msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" +#~ msgstr "%s %s, řádek %d: nevalidní syntax, chybí \"=\"\n" + +#, fuzzy +#~ msgid "value not defined" +#~ msgstr "Žádné pole nejsou definovány" + +#, fuzzy +#~ msgid "hidden" +#~ msgstr "(skrytý)" + +#, fuzzy +#~ msgid "" +#~ "%s%s: error creating option \"%s\" for server \"%s\" (server not found)" +#~ msgstr "%s volba nastavení \"%s\" nenalezena\n" + +#~ msgid "" +#~ "option: name of an option\n" +#~ " value: value for option" +#~ msgstr "" +#~ "možnost: jméno volby\n" +#~ "hodnota: hodnota volby" + #~ msgid "display nicklist (on buffers with nicklist enabled)" #~ msgstr "" #~ "zobrazit okno se seznamem přezdívek (pro buffery s povoleným seznamem " @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 18:36+0100\n" +"POT-Creation-Date: 2009-01-02 22:40+0100\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -345,6 +345,10 @@ msgstr " . Werte: " msgid "default value" msgstr " . Standardwert: %d\n" +#, fuzzy +msgid "(undefined)" +msgstr " . Standardwert: %d\n" + msgid "current value" msgstr "" @@ -1100,12 +1104,22 @@ msgstr "" msgid "set config options" msgstr "Konfigurationsparameter setzen" -msgid "[option [ = value]]" +#, fuzzy +msgid "[option [value]]" msgstr "[Option [ = Wert]]" msgid "" "option: name of an option\n" -" value: value for option" +" value: new value for option\n" +"\n" +"New value can be, according to variable type:\n" +" boolean: on, off ou toggle\n" +" integer: number, ++number ou --number string : any string (\"\" for empty " +"string)\n" +" color : color name, ++number ou --number\n" +"\n" +"For all types, you can use null to remove option value (undefined value). " +"This works only for some special plugin variables." msgstr "" #, fuzzy @@ -1695,7 +1709,7 @@ msgid "(default options)" msgstr "" #, fuzzy, c-format -msgid "%sWarning: config file \"%s\" not found" +msgid "%sWarning: configuration file \"%s\" not found" msgstr "%s Konfigurationsdatei \"%s\" nicht gefunden.\n" #, fuzzy, c-format @@ -1711,10 +1725,6 @@ msgid "%sWarning: %s, line %d: unknown section identifier (\"%s\")" msgstr "%s %s, Zeile %d: unbekannte Sektion \"%s\"\n" #, fuzzy, c-format -msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" -msgstr "%s %s, Zeile %d: Syntaxfehler, \"=\" erwartet\n" - -#, fuzzy, c-format msgid "%sWarning: %s, line %d: option \"%s\" unknown for section \"%s\"" msgstr "%s %s, Zeile %d: unbekannte Sektion \"%s\"\n" @@ -1730,60 +1740,6 @@ msgstr "%s %s, Zeile %d: ungültige Option \"%s\"\n" msgid "Reloading configuration file %s" msgstr "Konfiguration wird gespeichert\n" -msgid " . type: boolean\n" -msgstr " . Typ: Boolean\n" - -#, fuzzy -msgid " . values: \"on\" or \"off\"\n" -msgstr " . Werte ('on' oder 'off')\n" - -#, fuzzy, c-format -msgid " . default value: \"%s\"\n" -msgstr " . Standardwert: '%s'\n" - -msgid " . type: string\n" -msgstr " . Typ: Zeichenfolge\n" - -msgid " . values: " -msgstr " . Werte: " - -msgid " . type: integer\n" -msgstr " . Typ: Ganzzahl\n" - -#, c-format -msgid " . values: between %d and %d\n" -msgstr " . Werte: zwischen %d und %d\n" - -#, c-format -msgid " . default value: %d\n" -msgstr " . Standardwert: %d\n" - -msgid " . values: any string\n" -msgstr " . Werte: eine beliebige Zeichenfolge\n" - -#, fuzzy -msgid " . type: char\n" -msgstr " . Typ: Farbe\n" - -#, fuzzy -msgid " . values: any char\n" -msgstr " . Werte: eine beliebige Zeichenfolge\n" - -#, fuzzy, c-format -msgid " . values: any string (limit: %d chars)\n" -msgstr " . Werte: eine beliebige Zeichenfolge\n" - -msgid " . type: color\n" -msgstr " . Typ: Farbe\n" - -#, fuzzy -msgid " . values: color (depends on GUI used)\n" -msgstr " . Werte: zwischen %d und %d\n" - -#, c-format -msgid " . description: %s\n" -msgstr " . Beschreibung: %s\n" - #, c-format msgid "System clock skew detected (%+ld seconds), reinitializing all timers" msgstr "" @@ -2427,7 +2383,7 @@ msgid "%s%s: missing argument for \"%s\" option" msgstr "%s fehlende Argumente für die \"--dir\"-Option\n" #, fuzzy, c-format -msgid "%s: server %s%s%s created" +msgid "%s: server %s%s%s created (temporary server, NOT SAVED!)" msgstr "Server %s%s%s angelegt\n" #, fuzzy, c-format @@ -2538,6 +2494,20 @@ msgid "No server found with \"%s\"" msgstr "Server '%s' nicht gefunden.\n" #, fuzzy, c-format +msgid "%s%s: server \"%s\" already exists, can't create it!" +msgstr "" +"%s der Server \"%s\" existiert bereits und kann daher nicht angelegt " +"werden!\n" + +#, fuzzy, c-format +msgid "%s%s: unable to create server" +msgstr "%s kann den Server nicht anlegen\n" + +#, fuzzy, c-format +msgid "%s: server %s%s%s created" +msgstr "Server %s%s%s angelegt\n" + +#, fuzzy, c-format msgid "%s%s: server \"%s\" not found for \"%s\" command" msgstr "%s Server \"%s\" nicht gefunden für den \"%s\"-Befehl\n" @@ -2546,22 +2516,20 @@ msgid "%s%s: server \"%s\" already exists for \"%s\" command" msgstr "%s Server \"%s\" nicht gefunden für den \"%s\"-Befehl\n" #, fuzzy, c-format -msgid "%s: server %s%s%s has been renamed to %s%s" +msgid "%s: server %s%s%s has been copied to %s%s" msgstr "Server %s%s%s wurde gelöscht\n" #, fuzzy, c-format -msgid "%s%s: server \"%s\" already exists, can't create it!" -msgstr "" -"%s der Server \"%s\" existiert bereits und kann daher nicht angelegt " -"werden!\n" +msgid "%s: server %s%s%s has been renamed to %s%s" +msgstr "Server %s%s%s wurde gelöscht\n" #, fuzzy, c-format -msgid "%s%s: unable to create server" -msgstr "%s kann den Server nicht anlegen\n" +msgid "%s%s: server \"%s\" is not a temporary server" +msgstr "Server %s%s%s angelegt\n" #, fuzzy, c-format -msgid "%s: server %s%s%s has been copied to %s%s" -msgstr "Server %s%s%s wurde gelöscht\n" +msgid "%s: server %s%s%s is not temporary any more" +msgstr "Server %s%s%s angelegt\n" #, fuzzy, c-format msgid "" @@ -3111,7 +3079,8 @@ msgstr "Auflisten, Hinzufügen oder Entfernen von Servern" msgid "" "[list [servername]] | [listfull [servername]] | [add servername hostname[/" "port] [-auto | -noauto] [-ipv6] [-ssl]] | [copy servername newservername] | " -"[rename servername newservername] | [del servername] | [deloutq] | [switch]" +"[rename servername newservername] | [keep servername] | [del servername] | " +"[deloutq] | [switch]" msgstr "" "[Servername] | [Servername Hostname Port [-auto | -noauto] [-ipv6] [-ssl] [-" "pwd Passwort] [-nicks Nick1 Nick2 Nick3] [-username Benutzername] [-realname " @@ -3131,6 +3100,7 @@ msgid "" " ssl: use SSL protocol\n" " copy: duplicate a server\n" " rename: rename a server\n" +" keep: keep server in config file (for temporary servers only)\n" " del: delete a server\n" " deloutq: delete messages out queue for all servers (all messages WeeChat " "is currently sending)\n" @@ -3345,14 +3315,6 @@ msgstr "" msgid "%sirc: too few arguments for \"%s\" command" msgstr "%s fehlerhafte Argumente für der \"%s\"-Befehl\n" -#, fuzzy, c-format -msgid "%s%s: error creating server \"%s\"" -msgstr "%s nicht genügend Speicher für Infobar-Nachricht\n" - -#, fuzzy, c-format -msgid "%s%s: error creating option \"%s\" for server \"%s\" (server not found)" -msgstr "%s Konfigurationsoption \"%s\" nicht gefunden\n" - #, c-format msgid "" "%s%s: warning: server \"%s\" not found in configuration file, not deleted in " @@ -3432,6 +3394,10 @@ msgid "automatically rejoin channels when kicked" msgstr "Channels nach Kick automatisch wieder betreten, falls möglich" #, fuzzy, c-format +msgid "%s%s: error creating server \"%s\"" +msgstr "%s nicht genügend Speicher für Infobar-Nachricht\n" + +#, fuzzy, c-format msgid "%s%s: error creating server option \"%s\"" msgstr "%s nicht genügend Speicher für Infobar-Nachricht\n" @@ -3557,7 +3523,7 @@ msgid "IRC debug messages" msgstr "Debugging-Nachricht ausgeben" #, fuzzy, c-format -msgid "%sServer: %s%s %s[%s%s%s]" +msgid "%sServer: %s%s %s[%s%s%s]%s%s" msgstr "%sServer: %s%s %s[%s%s%s]\n" msgid "connected" @@ -3566,6 +3532,9 @@ msgstr "verbunden" msgid "not connected" msgstr "nicht verbunden" +msgid " (temporary)" +msgstr "" + msgid "on" msgstr "an" @@ -4146,11 +4115,11 @@ msgid "" " /logger disable\n" "\n" " set level to 3 for all IRC buffers:\n" -" /set logger.level.irc = 3\n" +" /set logger.level.irc 3\n" " disable logging for main WeeChat buffer:\n" -" /set logger.level.core.weechat = 0\n" +" /set logger.level.core.weechat 0\n" " use a directory per IRC server and a file per channel inside:\n" -" /set logger.mask.irc = $server/$channel.weechatlog\n" +" /set logger.mask.irc \"$server/$channel.weechatlog\"\n" "\n" "Log levels used by IRC plugin:\n" " 1: user message, notice, private\n" @@ -5099,6 +5068,74 @@ msgstr "%s DCC: kann die 'nonblock'-Option für den Socket nicht festlegen\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s fehlende Argumente für die \"--dir\"-Option\n" +#~ msgid " . type: boolean\n" +#~ msgstr " . Typ: Boolean\n" + +#, fuzzy +#~ msgid " . values: \"on\" or \"off\"\n" +#~ msgstr " . Werte ('on' oder 'off')\n" + +#, fuzzy +#~ msgid " . default value: \"%s\"\n" +#~ msgstr " . Standardwert: '%s'\n" + +#~ msgid " . type: string\n" +#~ msgstr " . Typ: Zeichenfolge\n" + +#~ msgid " . values: " +#~ msgstr " . Werte: " + +#~ msgid " . type: integer\n" +#~ msgstr " . Typ: Ganzzahl\n" + +#~ msgid " . values: between %d and %d\n" +#~ msgstr " . Werte: zwischen %d und %d\n" + +#~ msgid " . default value: %d\n" +#~ msgstr " . Standardwert: %d\n" + +#~ msgid " . values: any string\n" +#~ msgstr " . Werte: eine beliebige Zeichenfolge\n" + +#, fuzzy +#~ msgid " . type: char\n" +#~ msgstr " . Typ: Farbe\n" + +#, fuzzy +#~ msgid " . values: any char\n" +#~ msgstr " . Werte: eine beliebige Zeichenfolge\n" + +#, fuzzy +#~ msgid " . values: any string (limit: %d chars)\n" +#~ msgstr " . Werte: eine beliebige Zeichenfolge\n" + +#~ msgid " . type: color\n" +#~ msgstr " . Typ: Farbe\n" + +#, fuzzy +#~ msgid " . values: color (depends on GUI used)\n" +#~ msgstr " . Werte: zwischen %d und %d\n" + +#~ msgid " . description: %s\n" +#~ msgstr " . Beschreibung: %s\n" + +#, fuzzy +#~ msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" +#~ msgstr "%s %s, Zeile %d: Syntaxfehler, \"=\" erwartet\n" + +#, fuzzy +#~ msgid "value not defined" +#~ msgstr "Keine Aliases definiert.\n" + +#, fuzzy +#~ msgid "hidden" +#~ msgstr "(versteckt)" + +#, fuzzy +#~ msgid "" +#~ "%s%s: error creating option \"%s\" for server \"%s\" (server not found)" +#~ msgstr "%s Konfigurationsoption \"%s\" nicht gefunden\n" + #, fuzzy #~ msgid "display nicklist (on buffers with nicklist enabled)" #~ msgstr "Nicklisten-Fenster in Channelfenstern anzeigen" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 18:36+0100\n" +"POT-Creation-Date: 2009-01-02 22:40+0100\n" "PO-Revision-Date: 2007-09-19 12:09+0200\n" "Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -341,6 +341,10 @@ msgstr " . valores: " msgid "default value" msgstr " . valor por defecto: %d\n" +#, fuzzy +msgid "(undefined)" +msgstr " . valor por defecto: %d\n" + msgid "current value" msgstr "" @@ -1081,12 +1085,22 @@ msgstr "" msgid "set config options" msgstr "poner opciones de configuración" -msgid "[option [ = value]]" +#, fuzzy +msgid "[option [value]]" msgstr "[opción [ = valor]]" msgid "" "option: name of an option\n" -" value: value for option" +" value: new value for option\n" +"\n" +"New value can be, according to variable type:\n" +" boolean: on, off ou toggle\n" +" integer: number, ++number ou --number string : any string (\"\" for empty " +"string)\n" +" color : color name, ++number ou --number\n" +"\n" +"For all types, you can use null to remove option value (undefined value). " +"This works only for some special plugin variables." msgstr "" #, fuzzy @@ -1343,8 +1357,8 @@ msgstr "la cadena mostrada tras la finalización de los nombres de usuario" #, fuzzy msgid "use a marker (line or char) on buffers to show first unread line" msgstr "" -"usar un marcador en los servidores/canales para mostrar la primera lÃnea " -"sin leer" +"usar un marcador en los servidores/canales para mostrar la primera lÃnea sin " +"leer" #, fuzzy msgid "save configuration file on exit" @@ -1680,7 +1694,7 @@ msgid "(default options)" msgstr "" #, fuzzy, c-format -msgid "%sWarning: config file \"%s\" not found" +msgid "%sWarning: configuration file \"%s\" not found" msgstr "%s fichero de configuración \"%s\" no encontrado.\n" #, fuzzy, c-format @@ -1696,10 +1710,6 @@ msgid "%sWarning: %s, line %d: unknown section identifier (\"%s\")" msgstr "%s %s, lÃnea %d: identificador de sección desconocido (\"%s\")\n" #, fuzzy, c-format -msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" -msgstr "%s %s, lÃnea %d: sintaxis inválida, falta \"=\"\n" - -#, fuzzy, c-format msgid "%sWarning: %s, line %d: option \"%s\" unknown for section \"%s\"" msgstr "%s %s, lÃnea %d: identificador de sección desconocido (\"%s\")\n" @@ -1715,60 +1725,6 @@ msgstr "%s %s, lÃnea %d: opción \"%s\" inválida\n" msgid "Reloading configuration file %s" msgstr "Guardar configuración a disco\n" -msgid " . type: boolean\n" -msgstr " . tipo: booleano\n" - -#, fuzzy -msgid " . values: \"on\" or \"off\"\n" -msgstr " . valores: 'on' u 'off'\n" - -#, fuzzy, c-format -msgid " . default value: \"%s\"\n" -msgstr " . valor por defecto: '%s'\n" - -msgid " . type: string\n" -msgstr " . tipo: cadena\n" - -msgid " . values: " -msgstr " . valores: " - -msgid " . type: integer\n" -msgstr " . tipo: entero\n" - -#, c-format -msgid " . values: between %d and %d\n" -msgstr " . valores: entre %d y %d\n" - -#, c-format -msgid " . default value: %d\n" -msgstr " . valor por defecto: %d\n" - -msgid " . values: any string\n" -msgstr " . valores: cualquier cadena\n" - -#, fuzzy -msgid " . type: char\n" -msgstr " . tipo: color\n" - -#, fuzzy -msgid " . values: any char\n" -msgstr " . valores: cualquier cadena\n" - -#, fuzzy, c-format -msgid " . values: any string (limit: %d chars)\n" -msgstr " . valores: cualquier cadena\n" - -msgid " . type: color\n" -msgstr " . tipo: color\n" - -#, fuzzy -msgid " . values: color (depends on GUI used)\n" -msgstr " . valores: entre %d y %d\n" - -#, c-format -msgid " . description: %s\n" -msgstr " . descripción: %s\n" - #, c-format msgid "System clock skew detected (%+ld seconds), reinitializing all timers" msgstr "" @@ -2401,7 +2357,7 @@ msgid "%s%s: missing argument for \"%s\" option" msgstr "%s falta un argumento para la opción --dir\n" #, fuzzy, c-format -msgid "%s: server %s%s%s created" +msgid "%s: server %s%s%s created (temporary server, NOT SAVED!)" msgstr "Servidor %s%s%s creado\n" #, fuzzy, c-format @@ -2512,6 +2468,18 @@ msgid "No server found with \"%s\"" msgstr "Servidor '%s' no encontrado.\n" #, fuzzy, c-format +msgid "%s%s: server \"%s\" already exists, can't create it!" +msgstr "%s el servidor \"%s\" ya existe, ¡no se puede crear!\n" + +#, fuzzy, c-format +msgid "%s%s: unable to create server" +msgstr "%s no es posible crear el servidor\n" + +#, fuzzy, c-format +msgid "%s: server %s%s%s created" +msgstr "Servidor %s%s%s creado\n" + +#, fuzzy, c-format msgid "%s%s: server \"%s\" not found for \"%s\" command" msgstr "%s servidor \"%s\" no encontrado para el comando \"%s\"\n" @@ -2520,20 +2488,20 @@ msgid "%s%s: server \"%s\" already exists for \"%s\" command" msgstr "%s servidor \"%s\" no encontrado para el comando \"%s\"\n" #, fuzzy, c-format -msgid "%s: server %s%s%s has been renamed to %s%s" +msgid "%s: server %s%s%s has been copied to %s%s" msgstr "El servidor %s%s%s ha sido borrado\n" #, fuzzy, c-format -msgid "%s%s: server \"%s\" already exists, can't create it!" -msgstr "%s el servidor \"%s\" ya existe, ¡no se puede crear!\n" +msgid "%s: server %s%s%s has been renamed to %s%s" +msgstr "El servidor %s%s%s ha sido borrado\n" #, fuzzy, c-format -msgid "%s%s: unable to create server" -msgstr "%s no es posible crear el servidor\n" +msgid "%s%s: server \"%s\" is not a temporary server" +msgstr "Servidor %s%s%s creado\n" #, fuzzy, c-format -msgid "%s: server %s%s%s has been copied to %s%s" -msgstr "El servidor %s%s%s ha sido borrado\n" +msgid "%s: server %s%s%s is not temporary any more" +msgstr "Servidor %s%s%s creado\n" #, fuzzy, c-format msgid "" @@ -3096,7 +3064,8 @@ msgstr "lista, añde o elimina servidores" msgid "" "[list [servername]] | [listfull [servername]] | [add servername hostname[/" "port] [-auto | -noauto] [-ipv6] [-ssl]] | [copy servername newservername] | " -"[rename servername newservername] | [del servername] | [deloutq] | [switch]" +"[rename servername newservername] | [keep servername] | [del servername] | " +"[deloutq] | [switch]" msgstr "" "[nombre_de_servidor] | [nombre_de_servidor nombre/IP puerto [-auto | -" "noauto] [-ipv6] [-ssl] [-pwd contraseña] [-nicks alias1 alias2 alias3] [-" @@ -3117,6 +3086,7 @@ msgid "" " ssl: use SSL protocol\n" " copy: duplicate a server\n" " rename: rename a server\n" +" keep: keep server in config file (for temporary servers only)\n" " del: delete a server\n" " deloutq: delete messages out queue for all servers (all messages WeeChat " "is currently sending)\n" @@ -3336,15 +3306,6 @@ msgstr "" msgid "%sirc: too few arguments for \"%s\" command" msgstr "%s argumentos incorrectos para el comando \"%s\"\n" -#, fuzzy, c-format -msgid "%s%s: error creating server \"%s\"" -msgstr "" -"No hay suficiente memoria para el mensaje de la barra de información\n" - -#, fuzzy, c-format -msgid "%s%s: error creating option \"%s\" for server \"%s\" (server not found)" -msgstr "%s opción de configuración \"%s\" no encontrada\n" - #, c-format msgid "" "%s%s: warning: server \"%s\" not found in configuration file, not deleted in " @@ -3422,6 +3383,11 @@ msgid "automatically rejoin channels when kicked" msgstr "unirse de nuevo automáticamente a los canales cuando sea expulsado" #, fuzzy, c-format +msgid "%s%s: error creating server \"%s\"" +msgstr "" +"No hay suficiente memoria para el mensaje de la barra de información\n" + +#, fuzzy, c-format msgid "%s%s: error creating server option \"%s\"" msgstr "" "No hay suficiente memoria para el mensaje de la barra de información\n" @@ -3548,7 +3514,7 @@ msgid "IRC debug messages" msgstr "imprime mensajes de depuración" #, fuzzy, c-format -msgid "%sServer: %s%s %s[%s%s%s]" +msgid "%sServer: %s%s %s[%s%s%s]%s%s" msgstr "%sServidor:%s%s %s[%s%s%s]\n" msgid "connected" @@ -3557,6 +3523,9 @@ msgstr "conectado" msgid "not connected" msgstr "no conectado" +msgid " (temporary)" +msgstr "" + msgid "on" msgstr "activo" @@ -4142,11 +4111,11 @@ msgid "" " /logger disable\n" "\n" " set level to 3 for all IRC buffers:\n" -" /set logger.level.irc = 3\n" +" /set logger.level.irc 3\n" " disable logging for main WeeChat buffer:\n" -" /set logger.level.core.weechat = 0\n" +" /set logger.level.core.weechat 0\n" " use a directory per IRC server and a file per channel inside:\n" -" /set logger.mask.irc = $server/$channel.weechatlog\n" +" /set logger.mask.irc \"$server/$channel.weechatlog\"\n" "\n" "Log levels used by IRC plugin:\n" " 1: user message, notice, private\n" @@ -5101,6 +5070,74 @@ msgstr "%s no es posible crear el servidor\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s falta un argumento para la opción --dir\n" +#~ msgid " . type: boolean\n" +#~ msgstr " . tipo: booleano\n" + +#, fuzzy +#~ msgid " . values: \"on\" or \"off\"\n" +#~ msgstr " . valores: 'on' u 'off'\n" + +#, fuzzy +#~ msgid " . default value: \"%s\"\n" +#~ msgstr " . valor por defecto: '%s'\n" + +#~ msgid " . type: string\n" +#~ msgstr " . tipo: cadena\n" + +#~ msgid " . values: " +#~ msgstr " . valores: " + +#~ msgid " . type: integer\n" +#~ msgstr " . tipo: entero\n" + +#~ msgid " . values: between %d and %d\n" +#~ msgstr " . valores: entre %d y %d\n" + +#~ msgid " . default value: %d\n" +#~ msgstr " . valor por defecto: %d\n" + +#~ msgid " . values: any string\n" +#~ msgstr " . valores: cualquier cadena\n" + +#, fuzzy +#~ msgid " . type: char\n" +#~ msgstr " . tipo: color\n" + +#, fuzzy +#~ msgid " . values: any char\n" +#~ msgstr " . valores: cualquier cadena\n" + +#, fuzzy +#~ msgid " . values: any string (limit: %d chars)\n" +#~ msgstr " . valores: cualquier cadena\n" + +#~ msgid " . type: color\n" +#~ msgstr " . tipo: color\n" + +#, fuzzy +#~ msgid " . values: color (depends on GUI used)\n" +#~ msgstr " . valores: entre %d y %d\n" + +#~ msgid " . description: %s\n" +#~ msgstr " . descripción: %s\n" + +#, fuzzy +#~ msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" +#~ msgstr "%s %s, lÃnea %d: sintaxis inválida, falta \"=\"\n" + +#, fuzzy +#~ msgid "value not defined" +#~ msgstr "Ningún alias definido.\n" + +#, fuzzy +#~ msgid "hidden" +#~ msgstr "(oculto)" + +#, fuzzy +#~ msgid "" +#~ "%s%s: error creating option \"%s\" for server \"%s\" (server not found)" +#~ msgstr "%s opción de configuración \"%s\" no encontrada\n" + #, fuzzy #~ msgid "display nicklist (on buffers with nicklist enabled)" #~ msgstr "mostrar ventana de usuarios (para las ventanas de canal)" @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 18:36+0100\n" -"PO-Revision-Date: 2008-12-19 18:37+0100\n" +"POT-Creation-Date: 2009-01-02 22:40+0100\n" +"PO-Revision-Date: 2009-01-02 18:38+0100\n" "Last-Translator: FlashCode <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "MIME-Version: 1.0\n" @@ -325,6 +325,9 @@ msgstr "valeurs" msgid "default value" msgstr "valeur par défaut" +msgid "(undefined)" +msgstr "(non défini)" + msgid "current value" msgstr "valeur courante" @@ -1174,15 +1177,34 @@ msgstr "" msgid "set config options" msgstr "modifier des options de configuration" -msgid "[option [ = value]]" -msgstr "[option [ = valeur]]" +msgid "[option [value]]" +msgstr "[option [valeur]]" msgid "" "option: name of an option\n" -" value: value for option" +" value: new value for option\n" +"\n" +"New value can be, according to variable type:\n" +" boolean: on, off ou toggle\n" +" integer: number, ++number ou --number string : any string (\"\" for empty " +"string)\n" +" color : color name, ++number ou --number\n" +"\n" +"For all types, you can use null to remove option value (undefined value). " +"This works only for some special plugin variables." msgstr "" "option: nom d'une option\n" -"valeur: valeur pour l'option" +"valeur: nouvelle valeur pour l'option\n" +"\n" +"La nouvelle valeur peut être, selon le type de l'option :\n" +" booléen: on, off ou toggle\n" +" entier : nombre, ++nombre ou --nombre\n" +" chaîne : toute chaîne (\"\" pour une chaîne vide)\n" +" couleur: nom de couleur, ++nombre ou --nombre\n" +"\n" +"Pour tous les types, vous pouvez utiliser null pour supprimer la valeur de " +"l'option (valeur non définie). Cela ne fonctionne qu'avec certaines options " +"spéciales des extensions." msgid "unset/reset config options" msgstr "supprimer/réinitialiser des options de configuration" @@ -1767,8 +1789,8 @@ msgid "(default options)" msgstr "(options par défaut)" #, c-format -msgid "%sWarning: config file \"%s\" not found" -msgstr "%sAttention: fichier de configuration \"%s\" non trouvé." +msgid "%sWarning: configuration file \"%s\" not found" +msgstr "%sAttention: fichier de configuration \"%s\" non trouvé" #, c-format msgid "Reading configuration file %s" @@ -1783,10 +1805,6 @@ msgid "%sWarning: %s, line %d: unknown section identifier (\"%s\")" msgstr "%sAttention: %s, ligne %d: section inconnue (\"%s\")" #, c-format -msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" -msgstr "%sAttention: %s, ligne %d: syntaxe invalide, il manque \"=\"" - -#, c-format msgid "%sWarning: %s, line %d: option \"%s\" unknown for section \"%s\"" msgstr "" "%sAttention: %s, ligne %d: option \"%s\" inconnue pour la section \"%s\"" @@ -1803,56 +1821,6 @@ msgstr "%sAttention: %s, ligne %d: valeur invalide pour l'option \"%s\"" msgid "Reloading configuration file %s" msgstr "Rechargement du fichier de configuration %s" -msgid " . type: boolean\n" -msgstr " . type: booléen\n" - -msgid " . values: \"on\" or \"off\"\n" -msgstr " . valeurs: \"on\" ou \"off\"\n" - -#, c-format -msgid " . default value: \"%s\"\n" -msgstr " . valeur par défaut: \"%s\"\n" - -msgid " . type: string\n" -msgstr " . type: chaîne\n" - -msgid " . values: " -msgstr " . valeurs: " - -msgid " . type: integer\n" -msgstr " . type: entier\n" - -#, c-format -msgid " . values: between %d and %d\n" -msgstr " . valeurs: entre %d et %d\n" - -#, c-format -msgid " . default value: %d\n" -msgstr " . valeur par défaut: %d\n" - -msgid " . values: any string\n" -msgstr " . valeurs: toute chaîne\n" - -msgid " . type: char\n" -msgstr " . type: caractère\n" - -msgid " . values: any char\n" -msgstr " . valeurs: tout caractère\n" - -#, c-format -msgid " . values: any string (limit: %d chars)\n" -msgstr " . valeurs: toute chaîne (limite: %d caractères)\n" - -msgid " . type: color\n" -msgstr " . type: couleur\n" - -msgid " . values: color (depends on GUI used)\n" -msgstr " . valeurs: couleur (dépend de l'interface utilisée)\n" - -#, c-format -msgid " . description: %s\n" -msgstr " . description: %s\n" - #, c-format msgid "System clock skew detected (%+ld seconds), reinitializing all timers" msgstr "" @@ -2508,8 +2476,8 @@ msgid "%s%s: missing argument for \"%s\" option" msgstr "%s%s: paramètre manquant pour l'option \"%s\"" #, c-format -msgid "%s: server %s%s%s created" -msgstr "%s: serveur %s%s%s créé" +msgid "%s: server %s%s%s created (temporary server, NOT SAVED!)" +msgstr "%s: serveur %s%s%s créé (serveur temporaire, NON SAUVE !)" #, c-format msgid "%s%s: unable to create server \"%s\"" @@ -2618,6 +2586,18 @@ msgid "No server found with \"%s\"" msgstr "Pas de serveur trouvé avec \"%s\"" #, c-format +msgid "%s%s: server \"%s\" already exists, can't create it!" +msgstr "%s%s: le serveur \"%s\" existe déjà, impossible de le créer !" + +#, c-format +msgid "%s%s: unable to create server" +msgstr "%s%s: impossible de créer le serveur" + +#, c-format +msgid "%s: server %s%s%s created" +msgstr "%s: serveur %s%s%s créé" + +#, c-format msgid "%s%s: server \"%s\" not found for \"%s\" command" msgstr "%s%s: le serveur \"%s\" n'existe pas pour la commande \"%s\"" @@ -2626,20 +2606,20 @@ msgid "%s%s: server \"%s\" already exists for \"%s\" command" msgstr "%s%s: le serveur \"%s\" existe déjà pour la commande \"%s\"" #, c-format -msgid "%s: server %s%s%s has been renamed to %s%s" -msgstr "%s: le serveur %s%s%s a été renommé en %s%s" +msgid "%s: server %s%s%s has been copied to %s%s" +msgstr "%s: le serveur %s%s%s a été copié vers %s%s" #, c-format -msgid "%s%s: server \"%s\" already exists, can't create it!" -msgstr "%s%s: le serveur \"%s\" existe déjà, impossible de le créer !" +msgid "%s: server %s%s%s has been renamed to %s%s" +msgstr "%s: le serveur %s%s%s a été renommé en %s%s" #, c-format -msgid "%s%s: unable to create server" -msgstr "%s%s: impossible de créer le serveur" +msgid "%s%s: server \"%s\" is not a temporary server" +msgstr "%s%s: le serveur \"%s\" n'est pas temporaire" #, c-format -msgid "%s: server %s%s%s has been copied to %s%s" -msgstr "%s: le serveur %s%s%s a été copié vers %s%s" +msgid "%s: server %s%s%s is not temporary any more" +msgstr "%s: le serveur %s%s%s n'est plus temporaire" #, c-format msgid "" @@ -3212,12 +3192,13 @@ msgstr "liste, ajoute ou retire des serveurs" msgid "" "[list [servername]] | [listfull [servername]] | [add servername hostname[/" "port] [-auto | -noauto] [-ipv6] [-ssl]] | [copy servername newservername] | " -"[rename servername newservername] | [del servername] | [deloutq] | [switch]" +"[rename servername newservername] | [keep servername] | [del servername] | " +"[deloutq] | [switch]" msgstr "" "[list [nom_serveur]] | [listfull [nom_serveur]] | [add nom_serveur nom[/" "port] [-temp] [-auto | -noauto] [-ipv6] [-ssl]] | [copy nom_serveur " -"nouveau_nom_serveur] | [rename nom_serveur nouveau_nom_serveur] | [del " -"nom_serveur] | [deloutq] | [switch]" +"nouveau_nom_serveur] | [rename nom_serveur nouveau_nom_serveur] | [keep " +"nom_serveur] | [del nom_serveur] | [deloutq] | [switch]" msgid "" " list: list servers (no parameter implies this list)\n" @@ -3232,6 +3213,7 @@ msgid "" " ssl: use SSL protocol\n" " copy: duplicate a server\n" " rename: rename a server\n" +" keep: keep server in config file (for temporary servers only)\n" " del: delete a server\n" " deloutq: delete messages out queue for all servers (all messages WeeChat " "is currently sending)\n" @@ -3262,6 +3244,8 @@ msgstr "" " ssl: utiliser le protocole SSL\n" " copy: dupliquer un serveur\n" " rename: renommer un serveur\n" +" keep: garder le serveur dans le fichier de configuration (pour les " +"serveurs temporaires seulement)\n" " del: supprimer un serveur\n" " deloutq: supprimer la file d'attente des messages sortants pour tous les " "serveurs (tous les messages que WeeChat est actuellement en train " @@ -3466,16 +3450,6 @@ msgid "%sirc: too few arguments for \"%s\" command" msgstr "%sirc: pas assez de paramètres pour la commande \"%s\"" #, c-format -msgid "%s%s: error creating server \"%s\"" -msgstr "%s%s: erreur de création du serveur \"%s\"" - -#, c-format -msgid "%s%s: error creating option \"%s\" for server \"%s\" (server not found)" -msgstr "" -"%s%s: erreur de création de l'option \"%s\" pour le serveur \"%s\" (server " -"non trouvé)" - -#, c-format msgid "" "%s%s: warning: server \"%s\" not found in configuration file, not deleted in " "memory because it's currently used" @@ -3551,6 +3525,10 @@ msgid "automatically rejoin channels when kicked" msgstr "rejoindre automatiquement les canaux quand mis dehors" #, c-format +msgid "%s%s: error creating server \"%s\"" +msgstr "%s%s: erreur de création du serveur \"%s\"" + +#, c-format msgid "%s%s: error creating server option \"%s\"" msgstr "%s%s: erreur de création de l'option serveur \"%s\"" @@ -3676,8 +3654,8 @@ msgid "IRC debug messages" msgstr "Messages de debug IRC" #, c-format -msgid "%sServer: %s%s %s[%s%s%s]" -msgstr "%sServeur: %s%s %s[%s%s%s]" +msgid "%sServer: %s%s %s[%s%s%s]%s%s" +msgstr "%sServeur: %s%s %s[%s%s%s]%s%s" msgid "connected" msgstr "connecté" @@ -3685,6 +3663,9 @@ msgstr "connecté" msgid "not connected" msgstr "non connecté" +msgid " (temporary)" +msgstr " (temporaire)" + msgid "on" msgstr "activé" @@ -4277,11 +4258,11 @@ msgid "" " /logger disable\n" "\n" " set level to 3 for all IRC buffers:\n" -" /set logger.level.irc = 3\n" +" /set logger.level.irc 3\n" " disable logging for main WeeChat buffer:\n" -" /set logger.level.core.weechat = 0\n" +" /set logger.level.core.weechat 0\n" " use a directory per IRC server and a file per channel inside:\n" -" /set logger.mask.irc = $server/$channel.weechatlog\n" +" /set logger.mask.irc \"$server/$channel.weechatlog\"\n" "\n" "Log levels used by IRC plugin:\n" " 1: user message, notice, private\n" @@ -4307,11 +4288,11 @@ msgstr "" " désactiver l'enregistrement pour le tampon courant :\n" " /logger disable\n" " définir le niveau à 3 pour les tampons IRC :\n" -" /set logger.level.irc = 3\n" +" /set logger.level.irc 3\n" " désactiver l'enregistrement pour le tampon principal de WeeChat :\n" -" /set logger.level.core.weechat = 0\n" +" /set logger.level.core.weechat 0\n" " utiliser un répertoire par serveur IRC et un fichier par canal dedans :\n" -" /set logger.mask.irc = $server/$channel.weechatlog\n" +" /set logger.mask.irc \"$server/$channel.weechatlog\"\n" "\n" "Niveaux de log utilisés par l'extension IRC :\n" " 1: message d'utilisateur, notice, privé\n" @@ -5250,3 +5231,51 @@ msgstr "%s%s: impossible de positionner l'option \"nonblock\" pour la socket" #, c-format msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s%s: délai d'attente dépassé pour \"%s\" avec %s" + +#~ msgid " . type: boolean\n" +#~ msgstr " . type: booléen\n" + +#~ msgid " . values: \"on\" or \"off\"\n" +#~ msgstr " . valeurs: \"on\" ou \"off\"\n" + +#~ msgid " . default value: \"%s\"\n" +#~ msgstr " . valeur par défaut: \"%s\"\n" + +#~ msgid " . type: string\n" +#~ msgstr " . type: chaîne\n" + +#~ msgid " . values: " +#~ msgstr " . valeurs: " + +#~ msgid " . type: integer\n" +#~ msgstr " . type: entier\n" + +#~ msgid " . values: between %d and %d\n" +#~ msgstr " . valeurs: entre %d et %d\n" + +#~ msgid " . default value: %d\n" +#~ msgstr " . valeur par défaut: %d\n" + +#~ msgid " . values: any string\n" +#~ msgstr " . valeurs: toute chaîne\n" + +#~ msgid " . type: char\n" +#~ msgstr " . type: caractère\n" + +#~ msgid " . values: any char\n" +#~ msgstr " . valeurs: tout caractère\n" + +#~ msgid " . values: any string (limit: %d chars)\n" +#~ msgstr " . valeurs: toute chaîne (limite: %d caractères)\n" + +#~ msgid " . type: color\n" +#~ msgstr " . type: couleur\n" + +#~ msgid " . values: color (depends on GUI used)\n" +#~ msgstr " . valeurs: couleur (dépend de l'interface utilisée)\n" + +#~ msgid " . description: %s\n" +#~ msgstr " . description: %s\n" + +#~ msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" +#~ msgstr "%sAttention: %s, ligne %d: syntaxe invalide, il manque \"=\"" @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 18:36+0100\n" +"POT-Creation-Date: 2009-01-02 22:40+0100\n" "PO-Revision-Date: 2007-10-10 18:07+0200\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -346,6 +346,10 @@ msgstr " . értékek: " msgid "default value" msgstr " . alapérték: %d\n" +#, fuzzy +msgid "(undefined)" +msgstr " . alapérték: %d\n" + msgid "current value" msgstr "" @@ -1115,12 +1119,22 @@ msgstr "" msgid "set config options" msgstr "konfigurációs paraméterek beállítása" -msgid "[option [ = value]]" +#, fuzzy +msgid "[option [value]]" msgstr "[opció [ = érték]]" msgid "" "option: name of an option\n" -" value: value for option" +" value: new value for option\n" +"\n" +"New value can be, according to variable type:\n" +" boolean: on, off ou toggle\n" +" integer: number, ++number ou --number string : any string (\"\" for empty " +"string)\n" +" color : color name, ++number ou --number\n" +"\n" +"For all types, you can use null to remove option value (undefined value). " +"This works only for some special plugin variables." msgstr "" #, fuzzy @@ -1708,7 +1722,7 @@ msgid "(default options)" msgstr "" #, fuzzy, c-format -msgid "%sWarning: config file \"%s\" not found" +msgid "%sWarning: configuration file \"%s\" not found" msgstr "%s a \"%s\" beállítófájl nem található.\n" #, fuzzy, c-format @@ -1724,10 +1738,6 @@ msgid "%sWarning: %s, line %d: unknown section identifier (\"%s\")" msgstr "%s %s, %d. sor: ismeretlen csoportazonosító (\"%s\")\n" #, fuzzy, c-format -msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" -msgstr "%s %s, %d. sor: érvénytelen szintaxis, hiányzó \"=\"\n" - -#, fuzzy, c-format msgid "%sWarning: %s, line %d: option \"%s\" unknown for section \"%s\"" msgstr "%s %s, %d. sor: ismeretlen csoportazonosító (\"%s\")\n" @@ -1743,58 +1753,6 @@ msgstr "%s %s, %d. sor: érvénytelen opció: \"%s\"\n" msgid "Reloading configuration file %s" msgstr "Beállítások mentése a lemezre\n" -msgid " . type: boolean\n" -msgstr " . típus: logikai\n" - -#, fuzzy -msgid " . values: \"on\" or \"off\"\n" -msgstr " . értékek: 'on' vagy 'off'\n" - -#, fuzzy, c-format -msgid " . default value: \"%s\"\n" -msgstr " . alapérték: '%s'\n" - -msgid " . type: string\n" -msgstr " . típus: szöveg\n" - -msgid " . values: " -msgstr " . értékek: " - -msgid " . type: integer\n" -msgstr " . típus: szám\n" - -#, c-format -msgid " . values: between %d and %d\n" -msgstr " . értékek: %d és %d között\n" - -#, c-format -msgid " . default value: %d\n" -msgstr " . alapérték: %d\n" - -msgid " . values: any string\n" -msgstr " . érték: bármilyen szöveg\n" - -msgid " . type: char\n" -msgstr " . típus: karakter\n" - -msgid " . values: any char\n" -msgstr " . érték: bármilyen karakter\n" - -#, c-format -msgid " . values: any string (limit: %d chars)\n" -msgstr " . érték: bármilyen szöveg (korlát: %d karakter)\n" - -msgid " . type: color\n" -msgstr " . típus: szín\n" - -#, fuzzy -msgid " . values: color (depends on GUI used)\n" -msgstr " . értékek: %d és %d között\n" - -#, c-format -msgid " . description: %s\n" -msgstr " . leírás : %s\n" - #, c-format msgid "System clock skew detected (%+ld seconds), reinitializing all timers" msgstr "" @@ -2432,7 +2390,7 @@ msgid "%s%s: missing argument for \"%s\" option" msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" #, fuzzy, c-format -msgid "%s: server %s%s%s created" +msgid "%s: server %s%s%s created (temporary server, NOT SAVED!)" msgstr "A %s%s%s szerver létrehozva\n" #, fuzzy, c-format @@ -2541,6 +2499,18 @@ msgid "No server found with \"%s\"" msgstr "Nem található '%s' szerver.\n" #, fuzzy, c-format +msgid "%s%s: server \"%s\" already exists, can't create it!" +msgstr "%s a \"%s\" szerver már létezik, nem hozhatja létre!\n" + +#, fuzzy, c-format +msgid "%s%s: unable to create server" +msgstr "%s nem sikerült a szervert létrehozni\n" + +#, fuzzy, c-format +msgid "%s: server %s%s%s created" +msgstr "A %s%s%s szerver létrehozva\n" + +#, fuzzy, c-format msgid "%s%s: server \"%s\" not found for \"%s\" command" msgstr "%s a \"%s\" szerver nem található a \"%s\" parancshoz\n" @@ -2549,20 +2519,20 @@ msgid "%s%s: server \"%s\" already exists for \"%s\" command" msgstr "%s a \"%s\" szerver már létezik a(z) \"%s\" parancshoz\n" #, fuzzy, c-format -msgid "%s: server %s%s%s has been renamed to %s%s" -msgstr "A %s%s%s szerver mostantól: %s%s\n" +msgid "%s: server %s%s%s has been copied to %s%s" +msgstr "A %s%s%s szerver másolva lett %s%s néven\n" #, fuzzy, c-format -msgid "%s%s: server \"%s\" already exists, can't create it!" -msgstr "%s a \"%s\" szerver már létezik, nem hozhatja létre!\n" +msgid "%s: server %s%s%s has been renamed to %s%s" +msgstr "A %s%s%s szerver mostantól: %s%s\n" #, fuzzy, c-format -msgid "%s%s: unable to create server" -msgstr "%s nem sikerült a szervert létrehozni\n" +msgid "%s%s: server \"%s\" is not a temporary server" +msgstr "A %s%s%s szerver létrehozva\n" #, fuzzy, c-format -msgid "%s: server %s%s%s has been copied to %s%s" -msgstr "A %s%s%s szerver másolva lett %s%s néven\n" +msgid "%s: server %s%s%s is not temporary any more" +msgstr "A %s%s%s szerver létrehozva\n" #, fuzzy, c-format msgid "" @@ -3126,7 +3096,8 @@ msgstr "szerverek listázása, hozzáadása vagy eltávolítása" msgid "" "[list [servername]] | [listfull [servername]] | [add servername hostname[/" "port] [-auto | -noauto] [-ipv6] [-ssl]] | [copy servername newservername] | " -"[rename servername newservername] | [del servername] | [deloutq] | [switch]" +"[rename servername newservername] | [keep servername] | [del servername] | " +"[deloutq] | [switch]" msgstr "" "[list [szervernév]] | [listfull [szervernév]] | [add szervernév gépnév [-" "port port] [-temp] [-auto | -noauto] [-ipv6] [-ssl] [-pwd jelszó] [-nicks " @@ -3148,6 +3119,7 @@ msgid "" " ssl: use SSL protocol\n" " copy: duplicate a server\n" " rename: rename a server\n" +" keep: keep server in config file (for temporary servers only)\n" " del: delete a server\n" " deloutq: delete messages out queue for all servers (all messages WeeChat " "is currently sending)\n" @@ -3382,14 +3354,6 @@ msgstr "" msgid "%sirc: too few arguments for \"%s\" command" msgstr "%s rossz argumentum a \"%s\" parancsnak\n" -#, fuzzy, c-format -msgid "%s%s: error creating server \"%s\"" -msgstr "%s nincs elég memória az információs pult üzenethez\n" - -#, fuzzy, c-format -msgid "%s%s: error creating option \"%s\" for server \"%s\" (server not found)" -msgstr "%s a \"%s\" opció nem található\n" - #, c-format msgid "" "%s%s: warning: server \"%s\" not found in configuration file, not deleted in " @@ -3467,6 +3431,10 @@ msgid "automatically rejoin channels when kicked" msgstr "automatikus visszalépés a szobába kirúgáskor" #, fuzzy, c-format +msgid "%s%s: error creating server \"%s\"" +msgstr "%s nincs elég memória az információs pult üzenethez\n" + +#, fuzzy, c-format msgid "%s%s: error creating server option \"%s\"" msgstr "%s nincs elég memória az információs pult üzenethez\n" @@ -3583,7 +3551,7 @@ msgid "IRC debug messages" msgstr "hibakereső üzenetek megjelenítése" #, fuzzy, c-format -msgid "%sServer: %s%s %s[%s%s%s]" +msgid "%sServer: %s%s %s[%s%s%s]%s%s" msgstr "%s Szerver: %s%s %s[%s%s%s]\n" msgid "connected" @@ -3592,6 +3560,9 @@ msgstr "csatlakozva" msgid "not connected" msgstr "nincs csatlakozva" +msgid " (temporary)" +msgstr "" + msgid "on" msgstr "be" @@ -4173,11 +4144,11 @@ msgid "" " /logger disable\n" "\n" " set level to 3 for all IRC buffers:\n" -" /set logger.level.irc = 3\n" +" /set logger.level.irc 3\n" " disable logging for main WeeChat buffer:\n" -" /set logger.level.core.weechat = 0\n" +" /set logger.level.core.weechat 0\n" " use a directory per IRC server and a file per channel inside:\n" -" /set logger.mask.irc = $server/$channel.weechatlog\n" +" /set logger.mask.irc \"$server/$channel.weechatlog\"\n" "\n" "Log levels used by IRC plugin:\n" " 1: user message, notice, private\n" @@ -5121,6 +5092,71 @@ msgstr "%s DCC: nem sikerült 'nonblock' opciót beállítani a csatornán\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" +#~ msgid " . type: boolean\n" +#~ msgstr " . típus: logikai\n" + +#, fuzzy +#~ msgid " . values: \"on\" or \"off\"\n" +#~ msgstr " . értékek: 'on' vagy 'off'\n" + +#, fuzzy +#~ msgid " . default value: \"%s\"\n" +#~ msgstr " . alapérték: '%s'\n" + +#~ msgid " . type: string\n" +#~ msgstr " . típus: szöveg\n" + +#~ msgid " . values: " +#~ msgstr " . értékek: " + +#~ msgid " . type: integer\n" +#~ msgstr " . típus: szám\n" + +#~ msgid " . values: between %d and %d\n" +#~ msgstr " . értékek: %d és %d között\n" + +#~ msgid " . default value: %d\n" +#~ msgstr " . alapérték: %d\n" + +#~ msgid " . values: any string\n" +#~ msgstr " . érték: bármilyen szöveg\n" + +#~ msgid " . type: char\n" +#~ msgstr " . típus: karakter\n" + +#~ msgid " . values: any char\n" +#~ msgstr " . érték: bármilyen karakter\n" + +#~ msgid " . values: any string (limit: %d chars)\n" +#~ msgstr " . érték: bármilyen szöveg (korlát: %d karakter)\n" + +#~ msgid " . type: color\n" +#~ msgstr " . típus: szín\n" + +#, fuzzy +#~ msgid " . values: color (depends on GUI used)\n" +#~ msgstr " . értékek: %d és %d között\n" + +#~ msgid " . description: %s\n" +#~ msgstr " . leírás : %s\n" + +#, fuzzy +#~ msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" +#~ msgstr "%s %s, %d. sor: érvénytelen szintaxis, hiányzó \"=\"\n" + +#, fuzzy +#~ msgid "value not defined" +#~ msgstr "Nincs aliasz definiálva.\n" + +#, fuzzy +#~ msgid "hidden" +#~ msgstr "(rejtett)" + +#, fuzzy +#~ msgid "" +#~ "%s%s: error creating option \"%s\" for server \"%s\" (server not found)" +#~ msgstr "%s a \"%s\" opció nem található\n" + #, fuzzy #~ msgid "display nicklist (on buffers with nicklist enabled)" #~ msgstr "névlista ablak mutatása (szobaablakban)" @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 18:36+0100\n" +"POT-Creation-Date: 2009-01-02 22:40+0100\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -342,6 +342,10 @@ msgstr " . значения: " msgid "default value" msgstr " . значение по умолчанию: %d\n" +#, fuzzy +msgid "(undefined)" +msgstr " . значение по умолчанию: %d\n" + msgid "current value" msgstr "" @@ -1111,12 +1115,22 @@ msgstr "" msgid "set config options" msgstr "настроить параметры конфигурации" -msgid "[option [ = value]]" +#, fuzzy +msgid "[option [value]]" msgstr "[параметр [ = значение]]" msgid "" "option: name of an option\n" -" value: value for option" +" value: new value for option\n" +"\n" +"New value can be, according to variable type:\n" +" boolean: on, off ou toggle\n" +" integer: number, ++number ou --number string : any string (\"\" for empty " +"string)\n" +" color : color name, ++number ou --number\n" +"\n" +"For all types, you can use null to remove option value (undefined value). " +"This works only for some special plugin variables." msgstr "" #, fuzzy @@ -1709,7 +1723,7 @@ msgid "(default options)" msgstr "" #, fuzzy, c-format -msgid "%sWarning: config file \"%s\" not found" +msgid "%sWarning: configuration file \"%s\" not found" msgstr "%s конфигурационынй файл \"%s\" не найден.\n" #, fuzzy, c-format @@ -1725,10 +1739,6 @@ msgid "%sWarning: %s, line %d: unknown section identifier (\"%s\")" msgstr "%s %s, строка %d: неизвестный идентификатор секции (\"%s\")\n" #, fuzzy, c-format -msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" -msgstr "%s %s, строка %d: некорректный синтаксис, утерян \"=\"\n" - -#, fuzzy, c-format msgid "%sWarning: %s, line %d: option \"%s\" unknown for section \"%s\"" msgstr "%s %s, строка %d: неизвестный идентификатор секции (\"%s\")\n" @@ -1744,58 +1754,6 @@ msgstr "%s %s, строка %d: некорректный параметр \"%s\" msgid "Reloading configuration file %s" msgstr "Сохраняю конфигурацию\n" -msgid " . type: boolean\n" -msgstr " . тип: булевый\n" - -#, fuzzy -msgid " . values: \"on\" or \"off\"\n" -msgstr " . значения: 'on' или 'off'\n" - -#, fuzzy, c-format -msgid " . default value: \"%s\"\n" -msgstr " . значение по умолчанию: '%s'\n" - -msgid " . type: string\n" -msgstr " . тип: строка\n" - -msgid " . values: " -msgstr " . значения: " - -msgid " . type: integer\n" -msgstr " . тип: целочисленный\n" - -#, c-format -msgid " . values: between %d and %d\n" -msgstr " . значения: от %d до %d\n" - -#, c-format -msgid " . default value: %d\n" -msgstr " . значение по умолчанию: %d\n" - -msgid " . values: any string\n" -msgstr " . значения: любая строка\n" - -msgid " . type: char\n" -msgstr " . тип: символ\n" - -msgid " . values: any char\n" -msgstr " . значения: любой символ\n" - -#, c-format -msgid " . values: any string (limit: %d chars)\n" -msgstr " . значения: любая строка (ограничение: %d символов)\n" - -msgid " . type: color\n" -msgstr " . тип: цвет\n" - -#, fuzzy -msgid " . values: color (depends on GUI used)\n" -msgstr " . значения: от %d до %d\n" - -#, c-format -msgid " . description: %s\n" -msgstr " . описание: %s\n" - #, c-format msgid "System clock skew detected (%+ld seconds), reinitializing all timers" msgstr "" @@ -2436,7 +2394,7 @@ msgid "%s%s: missing argument for \"%s\" option" msgstr "%s нет аргумента для параметра \"%s\"\n" #, fuzzy, c-format -msgid "%s: server %s%s%s created" +msgid "%s: server %s%s%s created (temporary server, NOT SAVED!)" msgstr "Сервер %s%s%s создан\n" #, fuzzy, c-format @@ -2546,6 +2504,18 @@ msgid "No server found with \"%s\"" msgstr "Серверы с '%s' не найдены.\n" #, fuzzy, c-format +msgid "%s%s: server \"%s\" already exists, can't create it!" +msgstr "%s сервер \"%s\" уже существует, не могу создать его!\n" + +#, fuzzy, c-format +msgid "%s%s: unable to create server" +msgstr "%s не могу создать сервер\n" + +#, fuzzy, c-format +msgid "%s: server %s%s%s created" +msgstr "Сервер %s%s%s создан\n" + +#, fuzzy, c-format msgid "%s%s: server \"%s\" not found for \"%s\" command" msgstr "%s сервер \"%s\" не найден для команды \"%s\"\n" @@ -2554,20 +2524,20 @@ msgid "%s%s: server \"%s\" already exists for \"%s\" command" msgstr "%s сервер \"%s\" уже существует для команды \"%s\"\n" #, fuzzy, c-format -msgid "%s: server %s%s%s has been renamed to %s%s" -msgstr "Сервер %s%s%s переименован в %s%s\n" +msgid "%s: server %s%s%s has been copied to %s%s" +msgstr "Сервер %s%s%s скопирован в %s%s\n" #, fuzzy, c-format -msgid "%s%s: server \"%s\" already exists, can't create it!" -msgstr "%s сервер \"%s\" уже существует, не могу создать его!\n" +msgid "%s: server %s%s%s has been renamed to %s%s" +msgstr "Сервер %s%s%s переименован в %s%s\n" #, fuzzy, c-format -msgid "%s%s: unable to create server" -msgstr "%s не могу создать сервер\n" +msgid "%s%s: server \"%s\" is not a temporary server" +msgstr "Сервер %s%s%s создан\n" #, fuzzy, c-format -msgid "%s: server %s%s%s has been copied to %s%s" -msgstr "Сервер %s%s%s скопирован в %s%s\n" +msgid "%s: server %s%s%s is not temporary any more" +msgstr "Сервер %s%s%s создан\n" #, fuzzy, c-format msgid "" @@ -3126,7 +3096,8 @@ msgstr "перечислить, добавить или удалить серв msgid "" "[list [servername]] | [listfull [servername]] | [add servername hostname[/" "port] [-auto | -noauto] [-ipv6] [-ssl]] | [copy servername newservername] | " -"[rename servername newservername] | [del servername] | [deloutq] | [switch]" +"[rename servername newservername] | [keep servername] | [del servername] | " +"[deloutq] | [switch]" msgstr "" "[list [сервер]] | [listfull [сервер]] | [add сервер адрес [-port порт] [-" "temp] [-auto | -noauto] [-ipv6] [-ssl] [-pwd пароль] [-nicks ник1 ник2 ник3] " @@ -3148,6 +3119,7 @@ msgid "" " ssl: use SSL protocol\n" " copy: duplicate a server\n" " rename: rename a server\n" +" keep: keep server in config file (for temporary servers only)\n" " del: delete a server\n" " deloutq: delete messages out queue for all servers (all messages WeeChat " "is currently sending)\n" @@ -3375,14 +3347,6 @@ msgstr "" msgid "%sirc: too few arguments for \"%s\" command" msgstr "%s некорректные аргументы команды \"%s\"\n" -#, fuzzy, c-format -msgid "%s%s: error creating server \"%s\"" -msgstr "%s недостаточно памяти для сообщения в строке информации\n" - -#, fuzzy, c-format -msgid "%s%s: error creating option \"%s\" for server \"%s\" (server not found)" -msgstr "%s параметр конфигурации \"%s\" не найден\n" - #, c-format msgid "" "%s%s: warning: server \"%s\" not found in configuration file, not deleted in " @@ -3460,6 +3424,10 @@ msgid "automatically rejoin channels when kicked" msgstr "автоматически перезаходить на каналы после кика" #, fuzzy, c-format +msgid "%s%s: error creating server \"%s\"" +msgstr "%s недостаточно памяти для сообщения в строке информации\n" + +#, fuzzy, c-format msgid "%s%s: error creating server option \"%s\"" msgstr "%s недостаточно памяти для сообщения в строке информации\n" @@ -3576,7 +3544,7 @@ msgid "IRC debug messages" msgstr "выводить отладочные сообщения" #, fuzzy, c-format -msgid "%sServer: %s%s %s[%s%s%s]" +msgid "%sServer: %s%s %s[%s%s%s]%s%s" msgstr "%sСервер: %s%s %s[%s%s%s]\n" msgid "connected" @@ -3585,6 +3553,9 @@ msgstr "подключен" msgid "not connected" msgstr "отключен" +msgid " (temporary)" +msgstr "" + msgid "on" msgstr "вкл." @@ -4160,11 +4131,11 @@ msgid "" " /logger disable\n" "\n" " set level to 3 for all IRC buffers:\n" -" /set logger.level.irc = 3\n" +" /set logger.level.irc 3\n" " disable logging for main WeeChat buffer:\n" -" /set logger.level.core.weechat = 0\n" +" /set logger.level.core.weechat 0\n" " use a directory per IRC server and a file per channel inside:\n" -" /set logger.mask.irc = $server/$channel.weechatlog\n" +" /set logger.mask.irc \"$server/$channel.weechatlog\"\n" "\n" "Log levels used by IRC plugin:\n" " 1: user message, notice, private\n" @@ -5102,6 +5073,71 @@ msgstr "%s DCC: не могу установить неблокирующий р msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s нет аргумента для параметра \"%s\"\n" +#~ msgid " . type: boolean\n" +#~ msgstr " . тип: булевый\n" + +#, fuzzy +#~ msgid " . values: \"on\" or \"off\"\n" +#~ msgstr " . значения: 'on' или 'off'\n" + +#, fuzzy +#~ msgid " . default value: \"%s\"\n" +#~ msgstr " . значение по умолчанию: '%s'\n" + +#~ msgid " . type: string\n" +#~ msgstr " . тип: строка\n" + +#~ msgid " . values: " +#~ msgstr " . значения: " + +#~ msgid " . type: integer\n" +#~ msgstr " . тип: целочисленный\n" + +#~ msgid " . values: between %d and %d\n" +#~ msgstr " . значения: от %d до %d\n" + +#~ msgid " . default value: %d\n" +#~ msgstr " . значение по умолчанию: %d\n" + +#~ msgid " . values: any string\n" +#~ msgstr " . значения: любая строка\n" + +#~ msgid " . type: char\n" +#~ msgstr " . тип: символ\n" + +#~ msgid " . values: any char\n" +#~ msgstr " . значения: любой символ\n" + +#~ msgid " . values: any string (limit: %d chars)\n" +#~ msgstr " . значения: любая строка (ограничение: %d символов)\n" + +#~ msgid " . type: color\n" +#~ msgstr " . тип: цвет\n" + +#, fuzzy +#~ msgid " . values: color (depends on GUI used)\n" +#~ msgstr " . значения: от %d до %d\n" + +#~ msgid " . description: %s\n" +#~ msgstr " . описание: %s\n" + +#, fuzzy +#~ msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" +#~ msgstr "%s %s, строка %d: некорректный синтаксис, утерян \"=\"\n" + +#, fuzzy +#~ msgid "value not defined" +#~ msgstr "Сокращения не заданы.\n" + +#, fuzzy +#~ msgid "hidden" +#~ msgstr "(скрытый)" + +#, fuzzy +#~ msgid "" +#~ "%s%s: error creating option \"%s\" for server \"%s\" (server not found)" +#~ msgstr "%s параметр конфигурации \"%s\" не найден\n" + #, fuzzy #~ msgid "display nicklist (on buffers with nicklist enabled)" #~ msgstr "показывать список ников (в окнах каналов)" diff --git a/po/weechat.pot b/po/weechat.pot index 96b5ee6ba..8db196121 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-12-19 18:36+0100\n" +"POT-Creation-Date: 2009-01-02 22:40+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -304,6 +304,9 @@ msgstr "" msgid "default value" msgstr "" +msgid "(undefined)" +msgstr "" + msgid "current value" msgstr "" @@ -957,12 +960,21 @@ msgstr "" msgid "set config options" msgstr "" -msgid "[option [ = value]]" +msgid "[option [value]]" msgstr "" msgid "" "option: name of an option\n" -" value: value for option" +" value: new value for option\n" +"\n" +"New value can be, according to variable type:\n" +" boolean: on, off ou toggle\n" +" integer: number, ++number ou --number string : any string (\"\" for empty " +"string)\n" +" color : color name, ++number ou --number\n" +"\n" +"For all types, you can use null to remove option value (undefined value). " +"This works only for some special plugin variables." msgstr "" msgid "unset/reset config options" @@ -1430,7 +1442,7 @@ msgid "(default options)" msgstr "" #, c-format -msgid "%sWarning: config file \"%s\" not found" +msgid "%sWarning: configuration file \"%s\" not found" msgstr "" #, c-format @@ -1446,10 +1458,6 @@ msgid "%sWarning: %s, line %d: unknown section identifier (\"%s\")" msgstr "" #, c-format -msgid "%sWarning: %s, line %d: invalid syntax, missing \"=\"" -msgstr "" - -#, c-format msgid "%sWarning: %s, line %d: option \"%s\" unknown for section \"%s\"" msgstr "" @@ -1465,56 +1473,6 @@ msgstr "" msgid "Reloading configuration file %s" msgstr "" -msgid " . type: boolean\n" -msgstr "" - -msgid " . values: \"on\" or \"off\"\n" -msgstr "" - -#, c-format -msgid " . default value: \"%s\"\n" -msgstr "" - -msgid " . type: string\n" -msgstr "" - -msgid " . values: " -msgstr "" - -msgid " . type: integer\n" -msgstr "" - -#, c-format -msgid " . values: between %d and %d\n" -msgstr "" - -#, c-format -msgid " . default value: %d\n" -msgstr "" - -msgid " . values: any string\n" -msgstr "" - -msgid " . type: char\n" -msgstr "" - -msgid " . values: any char\n" -msgstr "" - -#, c-format -msgid " . values: any string (limit: %d chars)\n" -msgstr "" - -msgid " . type: color\n" -msgstr "" - -msgid " . values: color (depends on GUI used)\n" -msgstr "" - -#, c-format -msgid " . description: %s\n" -msgstr "" - #, c-format msgid "System clock skew detected (%+ld seconds), reinitializing all timers" msgstr "" @@ -2101,7 +2059,7 @@ msgid "%s%s: missing argument for \"%s\" option" msgstr "" #, c-format -msgid "%s: server %s%s%s created" +msgid "%s: server %s%s%s created (temporary server, NOT SAVED!)" msgstr "" #, c-format @@ -2208,6 +2166,18 @@ msgid "No server found with \"%s\"" msgstr "" #, c-format +msgid "%s%s: server \"%s\" already exists, can't create it!" +msgstr "" + +#, c-format +msgid "%s%s: unable to create server" +msgstr "" + +#, c-format +msgid "%s: server %s%s%s created" +msgstr "" + +#, c-format msgid "%s%s: server \"%s\" not found for \"%s\" command" msgstr "" @@ -2216,19 +2186,19 @@ msgid "%s%s: server \"%s\" already exists for \"%s\" command" msgstr "" #, c-format -msgid "%s: server %s%s%s has been renamed to %s%s" +msgid "%s: server %s%s%s has been copied to %s%s" msgstr "" #, c-format -msgid "%s%s: server \"%s\" already exists, can't create it!" +msgid "%s: server %s%s%s has been renamed to %s%s" msgstr "" #, c-format -msgid "%s%s: unable to create server" +msgid "%s%s: server \"%s\" is not a temporary server" msgstr "" #, c-format -msgid "%s: server %s%s%s has been copied to %s%s" +msgid "%s: server %s%s%s is not temporary any more" msgstr "" #, c-format @@ -2689,7 +2659,8 @@ msgstr "" msgid "" "[list [servername]] | [listfull [servername]] | [add servername hostname[/" "port] [-auto | -noauto] [-ipv6] [-ssl]] | [copy servername newservername] | " -"[rename servername newservername] | [del servername] | [deloutq] | [switch]" +"[rename servername newservername] | [keep servername] | [del servername] | " +"[deloutq] | [switch]" msgstr "" msgid "" @@ -2705,6 +2676,7 @@ msgid "" " ssl: use SSL protocol\n" " copy: duplicate a server\n" " rename: rename a server\n" +" keep: keep server in config file (for temporary servers only)\n" " del: delete a server\n" " deloutq: delete messages out queue for all servers (all messages WeeChat " "is currently sending)\n" @@ -2879,14 +2851,6 @@ msgid "%sirc: too few arguments for \"%s\" command" msgstr "" #, c-format -msgid "%s%s: error creating server \"%s\"" -msgstr "" - -#, c-format -msgid "%s%s: error creating option \"%s\" for server \"%s\" (server not found)" -msgstr "" - -#, c-format msgid "" "%s%s: warning: server \"%s\" not found in configuration file, not deleted in " "memory because it's currently used" @@ -2950,6 +2914,10 @@ msgid "automatically rejoin channels when kicked" msgstr "" #, c-format +msgid "%s%s: error creating server \"%s\"" +msgstr "" + +#, c-format msgid "%s%s: error creating server option \"%s\"" msgstr "" @@ -3052,7 +3020,7 @@ msgid "IRC debug messages" msgstr "" #, c-format -msgid "%sServer: %s%s %s[%s%s%s]" +msgid "%sServer: %s%s %s[%s%s%s]%s%s" msgstr "" msgid "connected" @@ -3061,6 +3029,9 @@ msgstr "" msgid "not connected" msgstr "" +msgid " (temporary)" +msgstr "" + msgid "on" msgstr "" @@ -3619,11 +3590,11 @@ msgid "" " /logger disable\n" "\n" " set level to 3 for all IRC buffers:\n" -" /set logger.level.irc = 3\n" +" /set logger.level.irc 3\n" " disable logging for main WeeChat buffer:\n" -" /set logger.level.core.weechat = 0\n" +" /set logger.level.core.weechat 0\n" " use a directory per IRC server and a file per channel inside:\n" -" /set logger.mask.irc = $server/$channel.weechatlog\n" +" /set logger.mask.irc \"$server/$channel.weechatlog\"\n" "\n" "Log levels used by IRC plugin:\n" " 1: user message, notice, private\n" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index dd66b640d..fb2c1d936 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -1352,15 +1352,33 @@ command_help (void *data, struct t_gui_buffer *buffer, _("type"), _("boolean")); gui_chat_printf (NULL, " %s: on, off", _("values")); - gui_chat_printf (NULL, " %s: %s", - _("default value"), - (CONFIG_BOOLEAN_DEFAULT(ptr_option) == CONFIG_BOOLEAN_TRUE) ? - "on" : "off"); - gui_chat_printf (NULL, " %s: %s%s", - _("current value"), - GUI_COLOR(GUI_COLOR_CHAT_HOST), - (CONFIG_BOOLEAN(ptr_option) == CONFIG_BOOLEAN_TRUE) ? - "on" : "off"); + if (ptr_option->default_value) + { + gui_chat_printf (NULL, " %s: %s", + _("default value"), + (CONFIG_BOOLEAN_DEFAULT(ptr_option) == CONFIG_BOOLEAN_TRUE) ? + "on" : "off"); + } + else + { + gui_chat_printf (NULL, " %s: %s", + _("default value"), + _("(undefined)")); + } + if (ptr_option->value) + { + gui_chat_printf (NULL, " %s: %s%s", + _("current value"), + GUI_COLOR(GUI_COLOR_CHAT_HOST), + (CONFIG_BOOLEAN(ptr_option) == CONFIG_BOOLEAN_TRUE) ? + "on" : "off"); + } + else + { + gui_chat_printf (NULL, " %s: %s", + _("current value"), + _("(undefined)")); + } break; case CONFIG_OPTION_TYPE_INTEGER: if (ptr_option->string_values) @@ -1390,15 +1408,34 @@ command_help (void *data, struct t_gui_buffer *buffer, _("type"), _("string")); gui_chat_printf (NULL, " %s: %s", _("values"), string); - gui_chat_printf (NULL, " %s: \"%s\"", - _("default value"), - ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)]); - gui_chat_printf (NULL, - " %s: \"%s%s%s\"", - _("current value"), - GUI_COLOR(GUI_COLOR_CHAT_HOST), - ptr_option->string_values[CONFIG_INTEGER(ptr_option)], - GUI_COLOR(GUI_COLOR_CHAT)); + if (ptr_option->default_value) + { + gui_chat_printf (NULL, " %s: \"%s\"", + _("default value"), + ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)]); + } + else + { + gui_chat_printf (NULL, " %s: %s", + _("default value"), + _("(undefined)")); + } + if (ptr_option->value) + { + gui_chat_printf (NULL, + " %s: \"%s%s%s\"", + _("current value"), + GUI_COLOR(GUI_COLOR_CHAT_HOST), + ptr_option->string_values[CONFIG_INTEGER(ptr_option)], + GUI_COLOR(GUI_COLOR_CHAT)); + } + else + { + gui_chat_printf (NULL, + " %s: %s", + _("current value"), + _("(undefined)")); + } free (string); } } @@ -1409,13 +1446,31 @@ command_help (void *data, struct t_gui_buffer *buffer, gui_chat_printf (NULL, " %s: %d .. %d", _("values"), ptr_option->min, ptr_option->max); - gui_chat_printf (NULL, " %s: %d", - _("default value"), - CONFIG_INTEGER_DEFAULT(ptr_option)); - gui_chat_printf (NULL, " %s: %s%d", - _("current value"), - GUI_COLOR(GUI_COLOR_CHAT_HOST), - CONFIG_INTEGER(ptr_option)); + if (ptr_option->default_value) + { + gui_chat_printf (NULL, " %s: %d", + _("default value"), + CONFIG_INTEGER_DEFAULT(ptr_option)); + } + else + { + gui_chat_printf (NULL, " %s: %s", + _("default value"), + _("(undefined)")); + } + if (ptr_option->value) + { + gui_chat_printf (NULL, " %s: %s%d", + _("current value"), + GUI_COLOR(GUI_COLOR_CHAT_HOST), + CONFIG_INTEGER(ptr_option)); + } + else + { + gui_chat_printf (NULL, " %s: %s", + _("current value"), + _("(undefined)")); + } } break; case CONFIG_OPTION_TYPE_STRING: @@ -1442,27 +1497,63 @@ command_help (void *data, struct t_gui_buffer *buffer, ptr_option->max); break; } - gui_chat_printf (NULL, " %s: \"%s\"", - _("default value"), - CONFIG_STRING_DEFAULT(ptr_option)); - gui_chat_printf (NULL, " %s: \"%s%s%s\"", - _("current value"), - GUI_COLOR(GUI_COLOR_CHAT_HOST), - CONFIG_STRING(ptr_option), - GUI_COLOR(GUI_COLOR_CHAT)); + if (ptr_option->default_value) + { + gui_chat_printf (NULL, " %s: \"%s\"", + _("default value"), + CONFIG_STRING_DEFAULT(ptr_option)); + } + else + { + gui_chat_printf (NULL, " %s: %s", + _("default value"), + _("(undefined)")); + } + if (ptr_option->value) + { + gui_chat_printf (NULL, " %s: \"%s%s%s\"", + _("current value"), + GUI_COLOR(GUI_COLOR_CHAT_HOST), + CONFIG_STRING(ptr_option), + GUI_COLOR(GUI_COLOR_CHAT)); + } + else + { + gui_chat_printf (NULL, " %s: %s", + _("current value"), + _("(undefined)")); + } break; case CONFIG_OPTION_TYPE_COLOR: gui_chat_printf (NULL, " %s: %s", _("type"), _("color")); gui_chat_printf (NULL, " %s: %s", _("values"), _("a color name")); - gui_chat_printf (NULL, " %s: %s", - _("default value"), - gui_color_get_name (CONFIG_COLOR_DEFAULT(ptr_option))); - gui_chat_printf (NULL, " %s: %s%s", - _("current value"), - GUI_COLOR(GUI_COLOR_CHAT_HOST), - gui_color_get_name (CONFIG_COLOR(ptr_option))); + if (ptr_option->default_value) + { + gui_chat_printf (NULL, " %s: %s", + _("default value"), + gui_color_get_name (CONFIG_COLOR_DEFAULT(ptr_option))); + } + else + { + gui_chat_printf (NULL, " %s: %s", + _("default value"), + _("(undefined)")); + } + if (ptr_option->value) + { + gui_chat_printf (NULL, " %s: %s%s", + _("current value"), + GUI_COLOR(GUI_COLOR_CHAT_HOST), + gui_color_get_name (CONFIG_COLOR(ptr_option))); + } + else + { + gui_chat_printf (NULL, " %s: %s", + _("current value"), + _("(undefined)")); + } break; case CONFIG_NUM_OPTION_TYPES: break; @@ -2634,23 +2725,12 @@ command_set_display_option (struct t_config_option *option, const char *message) { const char *color_name; - - switch (option->type) + + if (option->value) { - case CONFIG_OPTION_TYPE_BOOLEAN: - gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%s", - (message) ? message : " ", - option->config_file->name, - option->section->name, - option->name, - GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), - GUI_COLOR(GUI_COLOR_CHAT_HOST), - (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ? - "on" : "off"); - break; - case CONFIG_OPTION_TYPE_INTEGER: - if (option->string_values) - { + switch (option->type) + { + case CONFIG_OPTION_TYPE_BOOLEAN: gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%s", (message) ? message : " ", option->config_file->name, @@ -2658,45 +2738,67 @@ command_set_display_option (struct t_config_option *option, option->name, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), GUI_COLOR(GUI_COLOR_CHAT_HOST), - option->string_values[CONFIG_INTEGER(option)]); - } - else - { - gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%d", + (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ? + "on" : "off"); + break; + case CONFIG_OPTION_TYPE_INTEGER: + if (option->string_values) + { + gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%s", + (message) ? message : " ", + option->config_file->name, + option->section->name, + option->name, + GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), + GUI_COLOR(GUI_COLOR_CHAT_HOST), + option->string_values[CONFIG_INTEGER(option)]); + } + else + { + gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%d", + (message) ? message : " ", + option->config_file->name, + option->section->name, + option->name, + GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), + GUI_COLOR(GUI_COLOR_CHAT_HOST), + CONFIG_INTEGER(option)); + } + break; + case CONFIG_OPTION_TYPE_STRING: + gui_chat_printf (NULL, "%s%s.%s.%s%s = \"%s%s%s\"", (message) ? message : " ", option->config_file->name, option->section->name, option->name, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), GUI_COLOR(GUI_COLOR_CHAT_HOST), - CONFIG_INTEGER(option)); - } - break; - case CONFIG_OPTION_TYPE_STRING: - gui_chat_printf (NULL, "%s%s.%s.%s%s = \"%s%s%s\"", - (message) ? message : " ", - option->config_file->name, - option->section->name, - option->name, - GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), - GUI_COLOR(GUI_COLOR_CHAT_HOST), - (option->value) ? CONFIG_STRING(option) : "", - GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS)); - break; - case CONFIG_OPTION_TYPE_COLOR: - color_name = gui_color_get_name (CONFIG_COLOR(option)); - gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%s", - (message) ? message : " ", - option->config_file->name, - option->section->name, - option->name, - GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), - GUI_COLOR(GUI_COLOR_CHAT_HOST), - (color_name) ? color_name : _("(unknown)")); - break; - case CONFIG_NUM_OPTION_TYPES: - /* make C compiler happy */ - break; + CONFIG_STRING(option), + GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS)); + break; + case CONFIG_OPTION_TYPE_COLOR: + color_name = gui_color_get_name (CONFIG_COLOR(option)); + gui_chat_printf (NULL, "%s%s.%s.%s%s = %s%s", + (message) ? message : " ", + option->config_file->name, + option->section->name, + option->name, + GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), + GUI_COLOR(GUI_COLOR_CHAT_HOST), + (color_name) ? color_name : _("(unknown)")); + break; + case CONFIG_NUM_OPTION_TYPES: + /* make C compiler happy */ + break; + } + } + else + { + gui_chat_printf (NULL, "%s%s.%s.%s", + (message) ? message : " ", + option->config_file->name, + option->section->name, + option->name); } } @@ -2823,38 +2925,35 @@ command_set (void *data, struct t_gui_buffer *buffer, } /* set option value */ - if ((argc >= 4) && (string_strcasecmp (argv[2], "=") == 0)) - { - value = string_remove_quotes (argv_eol[3], "'\""); - rc = config_file_option_set_with_string (argv[1], - (value) ? value : argv_eol[3]); - if (value) - free (value); - switch (rc) - { - case WEECHAT_CONFIG_OPTION_SET_ERROR: - gui_chat_printf (NULL, - _("%sError: failed to set option \"%s\""), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - argv[1]); - return WEECHAT_RC_ERROR; - case WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND: - gui_chat_printf (NULL, - _("%sError: configuration option \"%s\" not " - "found"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - argv[1]); - return WEECHAT_RC_ERROR; - default: - config_file_search_with_string (argv[1], NULL, NULL, - &ptr_option, NULL); - if (ptr_option) - command_set_display_option (ptr_option, - _("Option changed: ")); - else - gui_chat_printf (NULL, _("Option changed")); - break; - } + value =(string_strcasecmp (argv_eol[2], WEECHAT_CONFIG_OPTION_NULL) == 0) ? + NULL : string_remove_quotes (argv_eol[2], "'\""); + rc = config_file_option_set_with_string (argv[1], value); + if (value) + free (value); + switch (rc) + { + case WEECHAT_CONFIG_OPTION_SET_ERROR: + gui_chat_printf (NULL, + _("%sError: failed to set option \"%s\""), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + argv[1]); + return WEECHAT_RC_ERROR; + case WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND: + gui_chat_printf (NULL, + _("%sError: configuration option \"%s\" not " + "found"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + argv[1]); + return WEECHAT_RC_ERROR; + default: + config_file_search_with_string (argv[1], NULL, NULL, + &ptr_option, NULL); + if (ptr_option) + command_set_display_option (ptr_option, + _("Option changed: ")); + else + gui_chat_printf (NULL, _("Option changed")); + break; } return WEECHAT_RC_OK; @@ -3659,10 +3758,18 @@ command_init () &command_save, NULL); hook_command (NULL, "set", N_("set config options"), - N_("[option [ = value]]"), + N_("[option [value]]"), N_("option: name of an option\n" - " value: value for option"), - "%o = %v", + " value: new value for option\n\n" + "New value can be, according to variable type:\n" + " boolean: on, off ou toggle\n" + " integer: number, ++number ou --number" + " string : any string (\"\" for empty string)\n" + " color : color name, ++number ou --number\n\n" + "For all types, you can use null to remove " + "option value (undefined value). This works only " + "for some special plugin variables."), + "%o %v", &command_set, NULL); hook_command (NULL, "unset", N_("unset/reset config options"), diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index 676429ce2..b770dc66e 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -16,7 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* wee-config-file.c: manages options in config files */ +/* wee-config-file.c: manages options in configuration files */ #ifdef HAVE_CONFIG_H @@ -74,7 +74,7 @@ config_file_search (const char *name) } /* - * config_file_new: create new config options structure + * config_file_new: create new configuration options structure */ struct t_config_file * @@ -90,7 +90,7 @@ config_file_new (struct t_weechat_plugin *plugin, const char *name, if (!name) return NULL; - /* it's NOT authorized to create two config files with same filename */ + /* it's NOT authorized to create two configuration files with same filename */ if (config_file_search (name)) return NULL; @@ -224,7 +224,7 @@ config_file_new_section (struct t_config_file *config_file, const char *name, } /* - * config_file_search_section: search a section in a config structure + * config_file_search_section: search a section in a configuration structure */ struct t_config_section * @@ -357,6 +357,7 @@ config_file_new_option (struct t_config_file *config_file, const char *string_values, int min, int max, const char *default_value, const char *value, + int null_value_allowed, int (*callback_check_value)(void *data, struct t_config_option *option, const char *value), @@ -397,10 +398,15 @@ config_file_new_option (struct t_config_file *config_file, return NULL; } - if (default_value && !value) - value = default_value; - else if (!default_value && value) - default_value = value; + if (!null_value_allowed) + { + if (default_value && !value) + value = default_value; + else if (!default_value && value) + default_value = value; + if (!default_value || !value) + return NULL; + } new_option = malloc (sizeof (*new_option)); if (new_option) @@ -410,6 +416,8 @@ config_file_new_option (struct t_config_file *config_file, new_option->name = strdup (name); new_option->type = var_type; new_option->description = (description) ? strdup (description) : NULL; + new_option->default_value = NULL; + new_option->value = NULL; argc = 0; switch (var_type) { @@ -417,12 +425,18 @@ config_file_new_option (struct t_config_file *config_file, new_option->string_values = NULL; new_option->min = CONFIG_BOOLEAN_FALSE; new_option->max = CONFIG_BOOLEAN_TRUE; - int_value = config_file_string_to_boolean (default_value); - new_option->default_value = malloc (sizeof (int)); - *((int *)new_option->default_value) = int_value; - int_value = config_file_string_to_boolean (value); - new_option->value = malloc (sizeof (int)); - *((int *)new_option->value) = int_value; + if (default_value) + { + int_value = config_file_string_to_boolean (default_value); + new_option->default_value = malloc (sizeof (int)); + *((int *)new_option->default_value) = int_value; + } + if (value) + { + int_value = config_file_string_to_boolean (value); + new_option->value = malloc (sizeof (int)); + *((int *)new_option->value) = int_value; + } break; case CONFIG_OPTION_TYPE_INTEGER: new_option->string_values = (string_values) ? @@ -431,81 +445,106 @@ config_file_new_option (struct t_config_file *config_file, { new_option->min = 0; new_option->max = (argc == 0) ? 0 : argc - 1; - index_value = 0; - for (i = 0; i < argc; i++) + if (default_value) { - if (string_strcasecmp (new_option->string_values[i], - default_value) == 0) + index_value = 0; + for (i = 0; i < argc; i++) { - index_value = i; - break; + if (string_strcasecmp (new_option->string_values[i], + default_value) == 0) + { + index_value = i; + break; + } } + new_option->default_value = malloc (sizeof (int)); + *((int *)new_option->default_value) = index_value; } - new_option->default_value = malloc (sizeof (int)); - *((int *)new_option->default_value) = index_value; - index_value = 0; - for (i = 0; i < argc; i++) + if (value) { - if (string_strcasecmp (new_option->string_values[i], - value) == 0) + index_value = 0; + for (i = 0; i < argc; i++) { - index_value = i; - break; + if (string_strcasecmp (new_option->string_values[i], + value) == 0) + { + index_value = i; + break; + } } + new_option->value = malloc (sizeof (int)); + *((int *)new_option->value) = index_value; } - new_option->value = malloc (sizeof (int)); - *((int *)new_option->value) = index_value; } else { new_option->string_values = NULL; new_option->min = min; new_option->max = max; - error = NULL; - number = strtol (default_value, &error, 10); - if (!error || error[0]) - number = 0; - if (number < min) - number = min; - else if (number > max) - number = max; - new_option->default_value = malloc (sizeof (int)); - *((int *)new_option->default_value) = number; - error = NULL; - number = strtol (value, &error, 10); - if (!error || error[0]) - number = 0; - if (number < min) - number = min; - else if (number > max) - number = max; - new_option->value = malloc (sizeof (int)); - *((int *)new_option->value) = number; + if (default_value) + { + error = NULL; + number = strtol (default_value, &error, 10); + if (!error || error[0]) + number = 0; + if (number < min) + number = min; + else if (number > max) + number = max; + new_option->default_value = malloc (sizeof (int)); + *((int *)new_option->default_value) = number; + } + if (value) + { + error = NULL; + number = strtol (value, &error, 10); + if (!error || error[0]) + number = 0; + if (number < min) + number = min; + else if (number > max) + number = max; + new_option->value = malloc (sizeof (int)); + *((int *)new_option->value) = number; + } } break; case CONFIG_OPTION_TYPE_STRING: new_option->string_values = NULL; new_option->min = min; new_option->max = max; - new_option->default_value = (default_value) ? - strdup (default_value) : NULL; - new_option->value = (value) ? - strdup (value) : NULL; + if (default_value) + { + new_option->default_value = (default_value) ? + strdup (default_value) : NULL; + } + if (value) + { + new_option->value = (value) ? + strdup (value) : NULL; + } break; case CONFIG_OPTION_TYPE_COLOR: new_option->string_values = NULL; new_option->min = min; new_option->max = gui_color_get_number () - 1; - new_option->default_value = malloc (sizeof (int)); - if (!gui_color_assign (new_option->default_value, default_value)) - *((int *)new_option->default_value) = 0; - new_option->value = malloc (sizeof (int)); - if (!gui_color_assign (new_option->value, value)) - *((int *)new_option->value) = 0; + if (default_value) + { + new_option->default_value = malloc (sizeof (int)); + if (!gui_color_assign (new_option->default_value, default_value)) + *((int *)new_option->default_value) = 0; + } + if (value) + { + new_option->value = malloc (sizeof (int)); + if (!gui_color_assign (new_option->value, value)) + *((int *)new_option->value) = 0; + } break; case CONFIG_NUM_OPTION_TYPES: break; } + new_option->null_value_allowed = null_value_allowed; new_option->callback_check_value = callback_check_value; new_option->callback_check_value_data = callback_check_value_data; new_option->callback_change = callback_change; @@ -554,7 +593,7 @@ config_file_option_full_name (struct t_config_option *option) } /* - * config_file_search_option: search an option in a config or section + * config_file_search_option: search an option in a configuration file or section */ struct t_config_option * @@ -593,8 +632,8 @@ config_file_search_option (struct t_config_file *config_file, } /* - * config_file_search_section_option: search an option in a config or section - * and return section/option + * config_file_search_section_option: search an option in a configuration file + * or section and return section/option */ void @@ -813,7 +852,7 @@ config_file_string_to_boolean (const char *text) int config_file_option_reset (struct t_config_option *option, int run_callback) { - int rc; + int rc, old_value_was_null; char value[256], *option_full_name; if (!option) @@ -821,43 +860,63 @@ config_file_option_reset (struct t_config_option *option, int run_callback) rc = WEECHAT_CONFIG_OPTION_SET_ERROR; value[0] = '\0'; - - switch (option->type) + + if (option->default_value) { - case CONFIG_OPTION_TYPE_BOOLEAN: - if (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_DEFAULT(option)) - rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; - else - { - CONFIG_BOOLEAN(option) = CONFIG_BOOLEAN_DEFAULT(option); - snprintf (value, sizeof (value), "%s", - CONFIG_BOOLEAN(option) ? - config_boolean_true[0] : config_boolean_false[0]); - rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; - } - break; - case CONFIG_OPTION_TYPE_INTEGER: - if (CONFIG_INTEGER(option) == CONFIG_INTEGER_DEFAULT(option)) + old_value_was_null = (option->value == NULL); + switch (option->type) + { + case CONFIG_OPTION_TYPE_BOOLEAN: + if (!option->value) + { + option->value = malloc (sizeof (int)); + CONFIG_BOOLEAN(option) = CONFIG_BOOLEAN_DEFAULT(option); + snprintf (value, sizeof (value), "%s", + CONFIG_BOOLEAN(option) ? + config_boolean_true[0] : config_boolean_false[0]); + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + } + else + { + if (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_DEFAULT(option)) + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + else + { + CONFIG_BOOLEAN(option) = CONFIG_BOOLEAN_DEFAULT(option); + snprintf (value, sizeof (value), "%s", + CONFIG_BOOLEAN(option) ? + config_boolean_true[0] : config_boolean_false[0]); + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + } + } + break; + case CONFIG_OPTION_TYPE_INTEGER: + if (!option->value) + { + option->value = malloc (sizeof (int)); + CONFIG_INTEGER(option) = 0; + } + if (CONFIG_INTEGER(option) == CONFIG_INTEGER_DEFAULT(option)) + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + else + { + CONFIG_INTEGER(option) = CONFIG_INTEGER_DEFAULT(option); + snprintf (value, sizeof (value), "%d", + CONFIG_INTEGER(option)); + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + } + break; + case CONFIG_OPTION_TYPE_STRING: rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; - else - { - CONFIG_INTEGER(option) = CONFIG_INTEGER_DEFAULT(option); - snprintf (value, sizeof (value), "%d", - CONFIG_INTEGER(option)); - rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; - } - break; - case CONFIG_OPTION_TYPE_STRING: - rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; - if ((!option->value && option->default_value) - || (option->value && !option->default_value) - || (strcmp ((char *)option->value, - (char *)option->default_value) != 0)) - rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; - if (option->value) - free (option->value); - if (option->default_value) - { + if (!option->value + || (strcmp ((char *)option->value, + (char *)option->default_value) != 0)) + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + if (option->value) + { + free (option->value); + option->value = NULL; + } option->value = strdup ((char *)option->default_value); if (option->value) { @@ -866,23 +925,42 @@ config_file_option_reset (struct t_config_option *option, int run_callback) } else rc = WEECHAT_CONFIG_OPTION_SET_ERROR; - } - else - option->value = NULL; - break; - case CONFIG_OPTION_TYPE_COLOR: - if (CONFIG_COLOR(option) == CONFIG_COLOR_DEFAULT(option)) - rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; - else + break; + case CONFIG_OPTION_TYPE_COLOR: + if (!option->value) + { + option->value = malloc (sizeof (int)); + CONFIG_INTEGER(option) = 0; + } + if (CONFIG_COLOR(option) == CONFIG_COLOR_DEFAULT(option)) + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + else + { + CONFIG_COLOR(option) = CONFIG_COLOR_DEFAULT(option); + snprintf (value, sizeof (value), "%d", + CONFIG_COLOR(option)); + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + } + break; + case CONFIG_NUM_OPTION_TYPES: + break; + } + if (old_value_was_null && option->value) + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + } + else + { + if (option->null_value_allowed) + { + if (option->value) { - CONFIG_COLOR(option) = CONFIG_COLOR_DEFAULT(option); - snprintf (value, sizeof (value), "%d", - CONFIG_COLOR(option)); + free (option->value); + option->value = NULL; rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; } - break; - case CONFIG_NUM_OPTION_TYPES: - break; + else + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + } } if ((rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED) @@ -909,7 +987,6 @@ config_file_option_reset (struct t_config_option *option, int run_callback) /* * config_file_option_set: set value for an option - * if value is NULL, then default value for option is set * return one of these values: * WEECHAT_CONFIG_OPTION_SET_OK_CHANGED * WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE @@ -920,7 +997,7 @@ int config_file_option_set (struct t_config_option *option, const char *value, int run_callback) { - int value_int, i, rc, new_value_ok; + int value_int, i, rc, new_value_ok, old_value_was_null; long number; char *error, *option_full_name; @@ -929,7 +1006,7 @@ config_file_option_set (struct t_config_option *option, const char *value, rc = WEECHAT_CONFIG_OPTION_SET_ERROR; - if (value && option->callback_check_value) + if (option->callback_check_value) { if (!(int)(option->callback_check_value) (option->callback_check_value_data, @@ -938,37 +1015,58 @@ config_file_option_set (struct t_config_option *option, const char *value, return WEECHAT_CONFIG_OPTION_SET_ERROR; } - switch (option->type) + if (value) { - case CONFIG_OPTION_TYPE_BOOLEAN: - if (value) - { - if (string_strcasecmp (value, "toggle") == 0) + old_value_was_null = (option->value == NULL); + switch (option->type) + { + case CONFIG_OPTION_TYPE_BOOLEAN: + if (!option->value) { - *((int *)option->value) = - (*((int *)option->value) == CONFIG_BOOLEAN_TRUE) ? - CONFIG_BOOLEAN_FALSE : CONFIG_BOOLEAN_TRUE; + option->value = malloc (sizeof (int)); + if (string_strcasecmp (value, "toggle") == 0) + CONFIG_BOOLEAN(option) = CONFIG_BOOLEAN_TRUE; + else + { + if (config_file_string_boolean_is_valid (value)) + { + value_int = config_file_string_to_boolean (value); + CONFIG_BOOLEAN(option) = value_int; + } + } rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; } else { - if (config_file_string_boolean_is_valid (value)) + if (string_strcasecmp (value, "toggle") == 0) { - value_int = config_file_string_to_boolean (value); - if (value_int == *((int *)option->value)) - rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; - else + CONFIG_BOOLEAN(option) = + (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ? + CONFIG_BOOLEAN_FALSE : CONFIG_BOOLEAN_TRUE; + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + } + else + { + if (config_file_string_boolean_is_valid (value)) { - *((int *)option->value) = value_int; - rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + value_int = config_file_string_to_boolean (value); + if (value_int == CONFIG_BOOLEAN(option)) + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + else + { + CONFIG_BOOLEAN(option) = value_int; + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + } } } } - } - break; - case CONFIG_OPTION_TYPE_INTEGER: - if (value) - { + break; + case CONFIG_OPTION_TYPE_INTEGER: + if (!option->value) + { + option->value = malloc (sizeof (int)); + CONFIG_INTEGER(option) = 0; + } if (option->string_values) { value_int = -1; @@ -979,7 +1077,7 @@ config_file_option_set (struct t_config_option *option, const char *value, if (error && !error[0]) { number = number % (option->max + 1); - value_int = (*((int *)option->value) + number) % + value_int = (CONFIG_INTEGER(option) + number) % (option->max + 1); } } @@ -990,7 +1088,7 @@ config_file_option_set (struct t_config_option *option, const char *value, if (error && !error[0]) { number = number % (option->max + 1); - value_int = (*((int *)option->value) + (option->max + 1) - number) % + value_int = (CONFIG_INTEGER(option) + (option->max + 1) - number) % (option->max + 1); } } @@ -1008,11 +1106,11 @@ config_file_option_set (struct t_config_option *option, const char *value, } if (value_int >= 0) { - if (value_int == *((int *)option->value)) + if (value_int == CONFIG_INTEGER(option)) rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; else { - *((int *)option->value) = value_int; + CONFIG_INTEGER(option) = value_int; rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; } } @@ -1026,7 +1124,7 @@ config_file_option_set (struct t_config_option *option, const char *value, number = strtol (value + 2, &error, 10); if (error && !error[0]) { - value_int = *((int *)option->value) + number; + value_int = CONFIG_INTEGER(option) + number; if (value_int <= option->max) new_value_ok = 1; } @@ -1037,7 +1135,7 @@ config_file_option_set (struct t_config_option *option, const char *value, number = strtol (value + 2, &error, 10); if (error && !error[0]) { - value_int = *((int *)option->value) - number; + value_int = CONFIG_INTEGER(option) - number; if (value_int >= option->min) new_value_ok = 1; } @@ -1056,83 +1154,100 @@ config_file_option_set (struct t_config_option *option, const char *value, } if (new_value_ok) { - if (value_int == *((int *)option->value)) + if (value_int == CONFIG_INTEGER(option)) rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; else { - *((int *)option->value) = value_int; + CONFIG_INTEGER(option) = value_int; rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; } } } - } - break; - case CONFIG_OPTION_TYPE_STRING: - rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; - if ((!option->value && value) - || (option->value && !value) - || (strcmp ((char *)option->value, value) != 0)) - rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; - if (option->value) - free (option->value); - if (value) - { + break; + case CONFIG_OPTION_TYPE_STRING: + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + if (!option->value + || (strcmp (CONFIG_STRING(option), value) != 0)) + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + if (option->value) + { + free (option->value); + option->value = NULL; + } option->value = strdup (value); if (!option->value) rc = WEECHAT_CONFIG_OPTION_SET_ERROR; - } - else - option->value = NULL; - break; - case CONFIG_OPTION_TYPE_COLOR: - value_int = -1; - if (strncmp (value, "++", 2) == 0) - { - error = NULL; - number = strtol (value + 2, &error, 10); - if (error && !error[0]) + break; + case CONFIG_OPTION_TYPE_COLOR: + if (!option->value) { - number = number % (option->max + 1); - value_int = (*((int *)option->value) + number) % - (option->max + 1); + option->value = malloc (sizeof (int)); + CONFIG_COLOR(option) = 0; } - } - else if (strncmp (value, "--", 2) == 0) - { - error = NULL; - number = strtol (value + 2, &error, 10); - if (error && !error[0]) + value_int = -1; + if (strncmp (value, "++", 2) == 0) { - number = number % (option->max + 1); - value_int = (*((int *)option->value) + (option->max + 1) - number) % - (option->max + 1); + error = NULL; + number = strtol (value + 2, &error, 10); + if (error && !error[0]) + { + number = number % (option->max + 1); + value_int = (CONFIG_COLOR(option) + number) % + (option->max + 1); + } + } + else if (strncmp (value, "--", 2) == 0) + { + error = NULL; + number = strtol (value + 2, &error, 10); + if (error && !error[0]) + { + number = number % (option->max + 1); + value_int = (CONFIG_COLOR(option) + (option->max + 1) - number) % + (option->max + 1); + } } - } - else - { - gui_color_assign (&value_int, value); - } - if (value_int >= 0) - { - if (value_int == *((int *)option->value)) - rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; else { - *((int *)option->value) = value_int; - rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + gui_color_assign (&value_int, value); } - } - break; - case CONFIG_NUM_OPTION_TYPES: - break; + if (value_int >= 0) + { + if (value_int == CONFIG_COLOR(option)) + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + else + { + CONFIG_COLOR(option) = value_int; + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + } + } + break; + case CONFIG_NUM_OPTION_TYPES: + break; + } + if (old_value_was_null && option->value) + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + } + else + { + if (option->null_value_allowed && option->value) + { + free (option->value); + option->value = NULL; + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + } + else + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; } + /* run callback if asked and value was changed */ if ((rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED) && run_callback && option->callback_change) { (void)(option->callback_change)(option->callback_change_data, option); } + /* run config hook(s) */ if (rc != WEECHAT_CONFIG_OPTION_SET_ERROR) { if (option->config_file && option->section) @@ -1150,6 +1265,61 @@ config_file_option_set (struct t_config_option *option, const char *value, } /* + * config_file_option_set_null: set null (undefined) value for an option + * return one of these values: + * WEECHAT_CONFIG_OPTION_SET_OK_CHANGED + * WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE + * WEECHAT_CONFIG_OPTION_SET_ERROR + */ + +int +config_file_option_set_null (struct t_config_option *option, int run_callback) +{ + int rc; + char *option_full_name; + + rc = WEECHAT_CONFIG_OPTION_SET_ERROR; + + /* null value is authorized only if it's allowed in option */ + if (option->null_value_allowed) + { + /* option was already null: do nothing */ + if (!option->value) + rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; + else + { + /* set option to null */ + free (option->value); + option->value = NULL; + rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; + } + } + + /* run callback if asked and value was changed */ + if ((rc == WEECHAT_CONFIG_OPTION_SET_OK_CHANGED) + && run_callback && option->callback_change) + { + (void)(option->callback_change)(option->callback_change_data, option); + } + + /* run config hook(s) */ + if (rc != WEECHAT_CONFIG_OPTION_SET_ERROR) + { + if (option->config_file && option->section) + { + option_full_name = config_file_option_full_name (option); + if (option_full_name) + { + hook_config_exec (option_full_name, NULL); + free (option_full_name); + } + } + } + + return rc; +} + +/* * config_file_option_unset: unset/reset option * return one of these values: * WEECHAT_CONFIG_OPTION_UNSET_OK_NO_RESET @@ -1226,7 +1396,8 @@ void config_file_option_rename (struct t_config_option *option, const char *new_name) { - if (!new_name || !new_name[0]) + if (!new_name || !new_name[0] + || config_file_search_option (option->config_file, option->section, new_name)) return; /* remove option from list */ @@ -1289,6 +1460,34 @@ config_file_option_get_pointer (struct t_config_option *option, } /* + * config_file_option_is_null: return 1 if value of option is null + * 0 if it is not null + */ + +int +config_file_option_is_null (struct t_config_option *option) +{ + if (!option) + return 1; + + return (option->value) ? 0 : 1; +} + +/* + * config_file_option_default_is_null: return 1 if default value of option is null + * 0 if it is not null + */ + +int +config_file_option_default_is_null (struct t_config_option *option) +{ + if (!option) + return 1; + + return (option->default_value) ? 0 : 1; +} + +/* * config_file_option_set_with_string: set value for an option (with a string * for name of option) * return one of these values: @@ -1315,7 +1514,11 @@ config_file_option_set_with_string (const char *option_name, const char *value) if (ptr_config && ptr_section) { if (ptr_option) - rc = config_file_option_set (ptr_option, value, 1); + { + rc = (value) ? + config_file_option_set (ptr_option, value, 1) : + config_file_option_set_null (ptr_option, 1); + } else { if (ptr_section->user_can_add_options @@ -1381,6 +1584,22 @@ config_file_option_boolean (struct t_config_option *option) } /* + * config_file_option_boolean_default: return default boolean value of an option + */ + +int +config_file_option_boolean_default (struct t_config_option *option) +{ + if (!option) + return 0; + + if (option->type == CONFIG_OPTION_TYPE_BOOLEAN) + return CONFIG_BOOLEAN_DEFAULT(option); + else + return 0; +} + +/* * config_file_option_integer: return integer value of an option */ @@ -1409,6 +1628,34 @@ config_file_option_integer (struct t_config_option *option) } /* + * config_file_option_integer_default: return default integer value of an option + */ + +int +config_file_option_integer_default (struct t_config_option *option) +{ + if (!option) + return 0; + + switch (option->type) + { + case CONFIG_OPTION_TYPE_BOOLEAN: + if (CONFIG_BOOLEAN_DEFAULT(option) == CONFIG_BOOLEAN_TRUE) + return 1; + else + return 0; + case CONFIG_OPTION_TYPE_INTEGER: + case CONFIG_OPTION_TYPE_COLOR: + return CONFIG_INTEGER_DEFAULT(option); + case CONFIG_OPTION_TYPE_STRING: + return 0; + case CONFIG_NUM_OPTION_TYPES: + break; + } + return 0; +} + +/* * config_file_option_string: return string value of an option */ @@ -1440,6 +1687,37 @@ config_file_option_string (struct t_config_option *option) } /* + * config_file_option_string_default: return default string value of an option + */ + +const char * +config_file_option_string_default (struct t_config_option *option) +{ + if (!option) + return NULL; + + switch (option->type) + { + case CONFIG_OPTION_TYPE_BOOLEAN: + if (CONFIG_BOOLEAN_DEFAULT(option)) + return config_boolean_true[0]; + else + return config_boolean_false[0]; + case CONFIG_OPTION_TYPE_INTEGER: + if (option->string_values) + return option->string_values[CONFIG_INTEGER_DEFAULT(option)]; + return NULL; + case CONFIG_OPTION_TYPE_STRING: + return CONFIG_STRING_DEFAULT(option); + case CONFIG_OPTION_TYPE_COLOR: + return gui_color_get_name (CONFIG_COLOR_DEFAULT(option)); + case CONFIG_NUM_OPTION_TYPES: + return NULL; + } + return NULL; +} + +/* * config_file_option_color: return color value of an option */ @@ -1453,7 +1731,20 @@ config_file_option_color (struct t_config_option *option) } /* - * config_file_write_option: write an option in a config file + * config_file_option_color_default: return default color value of an option + */ + +const char * +config_file_option_color_default (struct t_config_option *option) +{ + if (!option) + return NULL; + + return gui_color_get_name (CONFIG_COLOR_DEFAULT(option)); +} + +/* + * config_file_write_option: write an option in a configuration file */ void @@ -1462,42 +1753,50 @@ config_file_write_option (struct t_config_file *config_file, { if (!config_file || !config_file->file || !option) return; - - switch (option->type) + + if (option->value) { - case CONFIG_OPTION_TYPE_BOOLEAN: - string_iconv_fprintf (config_file->file, "%s = %s\n", - option->name, - (*((int *)option->value)) == CONFIG_BOOLEAN_TRUE ? - "on" : "off"); - break; - case CONFIG_OPTION_TYPE_INTEGER: - if (option->string_values) + switch (option->type) + { + case CONFIG_OPTION_TYPE_BOOLEAN: string_iconv_fprintf (config_file->file, "%s = %s\n", option->name, - option->string_values[*((int *)option->value)]); - else - string_iconv_fprintf (config_file->file, "%s = %d\n", + (*((int *)option->value)) == CONFIG_BOOLEAN_TRUE ? + "on" : "off"); + break; + case CONFIG_OPTION_TYPE_INTEGER: + if (option->string_values) + string_iconv_fprintf (config_file->file, "%s = %s\n", + option->name, + option->string_values[*((int *)option->value)]); + else + string_iconv_fprintf (config_file->file, "%s = %d\n", + option->name, + *((int *)option->value)); + break; + case CONFIG_OPTION_TYPE_STRING: + string_iconv_fprintf (config_file->file, "%s = \"%s\"\n", option->name, - *((int *)option->value)); - break; - case CONFIG_OPTION_TYPE_STRING: - string_iconv_fprintf (config_file->file, "%s = \"%s\"\n", - option->name, - (char *)option->value); - break; - case CONFIG_OPTION_TYPE_COLOR: - string_iconv_fprintf (config_file->file, "%s = %s\n", - option->name, - gui_color_get_name (*((int *)option->value))); - break; - case CONFIG_NUM_OPTION_TYPES: - break; + (char *)option->value); + break; + case CONFIG_OPTION_TYPE_COLOR: + string_iconv_fprintf (config_file->file, "%s = %s\n", + option->name, + gui_color_get_name (*((int *)option->value))); + break; + case CONFIG_NUM_OPTION_TYPES: + break; + } + } + else + { + string_iconv_fprintf (config_file->file, "%s\n", + option->name); } } /* - * config_file_write_line: write a line in a config file + * config_file_write_line: write a line in a configuration file * if value is NULL, then write a section with [ ] around */ @@ -1670,7 +1969,7 @@ config_file_write (struct t_config_file *config_file) int config_file_read_internal (struct t_config_file *config_file, int reload) { - int filename_length, line_number, rc; + int filename_length, line_number, rc, undefined_value; char *filename; struct t_config_section *ptr_section; struct t_config_option *ptr_option; @@ -1694,7 +1993,7 @@ config_file_read_internal (struct t_config_file *config_file, int reload) if (!config_file->file) { gui_chat_printf (NULL, - _("%sWarning: config file \"%s\" not found"), + _("%sWarning: configuration file \"%s\" not found"), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], filename); free (filename); @@ -1760,22 +2059,24 @@ config_file_read_internal (struct t_config_file *config_file, int reload) } else { - pos = strstr (line, " = "); - if (!pos) - { - gui_chat_printf (NULL, - _("%sWarning: %s, line %d: invalid " - "syntax, missing \"=\""), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - filename, line_number); - } - else + undefined_value = 1; + + /* remove CR/LF */ + pos = strchr (line, '\r'); + if (pos != NULL) + pos[0] = '\0'; + pos = strchr (line, '\n'); + if (pos != NULL) + pos[0] = '\0'; + + pos = strstr (line, " ="); + if (pos) { pos[0] = '\0'; - pos += 3; + pos += 2; /* remove spaces before '=' */ - pos2 = pos - 4; + pos2 = pos - 3; while ((pos2 > line) && (pos2[0] == ' ')) { pos2[0] = '\0'; @@ -1788,101 +2089,100 @@ config_file_read_internal (struct t_config_file *config_file, int reload) pos++; } - /* remove CR/LF */ - pos2 = strchr (pos, '\r'); - if (pos2 != NULL) - pos2[0] = '\0'; - pos2 = strchr (pos, '\n'); - if (pos2 != NULL) - pos2[0] = '\0'; - - /* remove simple or double quotes - and spaces at the end */ - if (strlen(pos) > 1) + if (pos[0] + && string_strcasecmp (pos, WEECHAT_CONFIG_OPTION_NULL) != 0) { - pos2 = pos + strlen (pos) - 1; - while ((pos2 > pos) && (pos2[0] == ' ')) - { - pos2[0] = '\0'; - pos2--; - } - pos2 = pos + strlen (pos) - 1; - if (((pos[0] == '\'') && - (pos2[0] == '\'')) || - ((pos[0] == '"') && - (pos2[0] == '"'))) + undefined_value = 0; + /* remove simple or double quotes and spaces at the end */ + if (strlen(pos) > 1) { - pos2[0] = '\0'; - pos++; + pos2 = pos + strlen (pos) - 1; + while ((pos2 > pos) && (pos2[0] == ' ')) + { + pos2[0] = '\0'; + pos2--; + } + pos2 = pos + strlen (pos) - 1; + if (((pos[0] == '\'') && + (pos2[0] == '\'')) || + ((pos[0] == '"') && + (pos2[0] == '"'))) + { + pos2[0] = '\0'; + pos++; + } } } - - if (ptr_section && ptr_section->callback_read) + } + + if (ptr_section && ptr_section->callback_read) + { + ptr_option = NULL; + rc = (ptr_section->callback_read) + (ptr_section->callback_read_data, + config_file, + ptr_section, + line, + (undefined_value) ? NULL : pos); + } + else + { + rc = WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND; + ptr_option = config_file_search_option (config_file, + ptr_section, + line); + if (ptr_option) { - ptr_option = NULL; - rc = (ptr_section->callback_read) - (ptr_section->callback_read_data, - config_file, - ptr_section, - line, - pos); + rc = config_file_option_set (ptr_option, + (undefined_value) ? + NULL : pos, + 1); + ptr_option->loaded = 1; } else { - rc = WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND; - ptr_option = config_file_search_option (config_file, - ptr_section, - line); - if (ptr_option) + if (ptr_section + && ptr_section->callback_create_option) { - rc = config_file_option_set (ptr_option, pos, 1); - ptr_option->loaded = 1; - } - else - { - if (ptr_section - && ptr_section->callback_create_option) - { - rc = (int)(ptr_section->callback_create_option) - (ptr_section->callback_create_option_data, - config_file, - ptr_section, - line, - pos); - } + rc = (int)(ptr_section->callback_create_option) + (ptr_section->callback_create_option_data, + config_file, + ptr_section, + line, + (undefined_value) ? NULL : pos); } } - - switch (rc) - { - case WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND: - if (ptr_section) - gui_chat_printf (NULL, - _("%sWarning: %s, line %d: " - "option \"%s\" " - "unknown for " - "section \"%s\""), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - filename, line_number, - line, ptr_section->name); - else - gui_chat_printf (NULL, - _("%sWarning: %s, line %d: " - "unknown option \"%s\" " - "(outside a section)"), - gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - filename, line_number, - line); - break; - case WEECHAT_CONFIG_OPTION_SET_ERROR: + } + + switch (rc) + { + case WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND: + if (ptr_section) gui_chat_printf (NULL, _("%sWarning: %s, line %d: " - "invalid value for option " - "\"%s\""), + "option \"%s\" " + "unknown for " + "section \"%s\""), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - filename, line_number, line); - break; - } + filename, line_number, + line, ptr_section->name); + else + gui_chat_printf (NULL, + _("%sWarning: %s, line %d: " + "unknown option \"%s\" " + "(outside a section)"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + filename, line_number, + line); + break; + case WEECHAT_CONFIG_OPTION_SET_ERROR: + gui_chat_printf (NULL, + _("%sWarning: %s, line %d: " + "invalid value for option " + "\"%s\""), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], + filename, line_number, line); + break; } } } @@ -1934,10 +2234,13 @@ config_file_reload (struct t_config_file *config_file) for (ptr_section = config_file->sections; ptr_section; ptr_section = ptr_section->next_section) { - for (ptr_option = ptr_section->options; ptr_option; - ptr_option = ptr_option->next_option) + if (!ptr_section->callback_read) { - ptr_option->loaded = 0; + for (ptr_option = ptr_section->options; ptr_option; + ptr_option = ptr_option->next_option) + { + ptr_option->loaded = 0; + } } } @@ -1948,11 +2251,14 @@ config_file_reload (struct t_config_file *config_file) for (ptr_section = config_file->sections; ptr_section; ptr_section = ptr_section->next_section) { - for (ptr_option = ptr_section->options; ptr_option; - ptr_option = ptr_option->next_option) + if (!ptr_section->callback_read) { - if (!ptr_option->loaded) - config_file_option_reset (ptr_option, 1); + for (ptr_option = ptr_section->options; ptr_option; + ptr_option = ptr_option->next_option) + { + if (!ptr_option->loaded) + config_file_option_reset (ptr_option, 1); + } } } @@ -2083,7 +2389,7 @@ config_file_free (struct t_config_file *config_file) if (!config_file) return; - /* remove config file */ + /* remove configuration file */ if (last_config_file == config_file) last_config_file = config_file->prev_config; if (config_file->prev_config) @@ -2147,7 +2453,7 @@ config_file_free_all_plugin (struct t_weechat_plugin *plugin) } /* - * config_file_add_to_infolist: add config options in an infolist + * config_file_add_to_infolist: add configuration options in an infolist * return 1 if ok, 0 if error */ @@ -2264,6 +2570,22 @@ config_file_add_to_infolist (struct t_infolist *infolist, free (option_full_name); return 0; } + if (!infolist_new_var_integer (ptr_item, + "value_is_null", + (ptr_option->value) ? + 0 : 1)) + { + free (option_full_name); + return 0; + } + if (!infolist_new_var_integer (ptr_item, + "default_value_is_null", + (ptr_option->default_value) ? + 0 : 1)) + { + free (option_full_name); + return 0; + } switch (ptr_option->type) { case CONFIG_OPTION_TYPE_BOOLEAN: @@ -2274,27 +2596,33 @@ config_file_add_to_infolist (struct t_infolist *infolist, free (option_full_name); return 0; } - if (CONFIG_BOOLEAN(ptr_option) == CONFIG_BOOLEAN_TRUE) - snprintf (value, sizeof (value), "on"); - else - snprintf (value, sizeof (value), "off"); - if (!infolist_new_var_string (ptr_item, - "value", - value)) + if (ptr_option->value) { - free (option_full_name); - return 0; + if (CONFIG_BOOLEAN(ptr_option) == CONFIG_BOOLEAN_TRUE) + snprintf (value, sizeof (value), "on"); + else + snprintf (value, sizeof (value), "off"); + if (!infolist_new_var_string (ptr_item, + "value", + value)) + { + free (option_full_name); + return 0; + } } - if (CONFIG_BOOLEAN_DEFAULT(ptr_option) == CONFIG_BOOLEAN_TRUE) - snprintf (value, sizeof (value), "on"); - else - snprintf (value, sizeof (value), "off"); - if (!infolist_new_var_string (ptr_item, - "default_value", - value)) + if (ptr_option->default_value) { - free (option_full_name); - return 0; + if (CONFIG_BOOLEAN_DEFAULT(ptr_option) == CONFIG_BOOLEAN_TRUE) + snprintf (value, sizeof (value), "on"); + else + snprintf (value, sizeof (value), "off"); + if (!infolist_new_var_string (ptr_item, + "default_value", + value)) + { + free (option_full_name); + return 0; + } } break; case CONFIG_OPTION_TYPE_INTEGER: @@ -2307,40 +2635,52 @@ config_file_add_to_infolist (struct t_infolist *infolist, } if (ptr_option->string_values) { - if (!infolist_new_var_string (ptr_item, - "value", - ptr_option->string_values[CONFIG_INTEGER(ptr_option)])) + if (ptr_option->value) { - free (option_full_name); - return 0; + if (!infolist_new_var_string (ptr_item, + "value", + ptr_option->string_values[CONFIG_INTEGER(ptr_option)])) + { + free (option_full_name); + return 0; + } } - if (!infolist_new_var_string (ptr_item, - "default_value", - ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)])) + if (ptr_option->default_value) { - free (option_full_name); - return 0; + if (!infolist_new_var_string (ptr_item, + "default_value", + ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)])) + { + free (option_full_name); + return 0; + } } } else { - snprintf (value, sizeof (value), "%d", - CONFIG_INTEGER(ptr_option)); - if (!infolist_new_var_string (ptr_item, - "value", - value)) + if (ptr_option->value) { - free (option_full_name); - return 0; + snprintf (value, sizeof (value), "%d", + CONFIG_INTEGER(ptr_option)); + if (!infolist_new_var_string (ptr_item, + "value", + value)) + { + free (option_full_name); + return 0; + } } - snprintf (value, sizeof (value), "%d", - CONFIG_INTEGER_DEFAULT(ptr_option)); - if (!infolist_new_var_string (ptr_item, - "default_value", - value)) + if (ptr_option->default_value) { - free (option_full_name); - return 0; + snprintf (value, sizeof (value), "%d", + CONFIG_INTEGER_DEFAULT(ptr_option)); + if (!infolist_new_var_string (ptr_item, + "default_value", + value)) + { + free (option_full_name); + return 0; + } } } break; @@ -2352,19 +2692,25 @@ config_file_add_to_infolist (struct t_infolist *infolist, free (option_full_name); return 0; } - if (!infolist_new_var_string (ptr_item, - "value", - CONFIG_STRING(ptr_option))) + if (ptr_option->value) { - free (option_full_name); - return 0; + if (!infolist_new_var_string (ptr_item, + "value", + CONFIG_STRING(ptr_option))) + { + free (option_full_name); + return 0; + } } - if (!infolist_new_var_string (ptr_item, - "default_value", - CONFIG_STRING_DEFAULT(ptr_option))) + if (ptr_option->default_value) { - free (option_full_name); - return 0; + if (!infolist_new_var_string (ptr_item, + "default_value", + CONFIG_STRING_DEFAULT(ptr_option))) + { + free (option_full_name); + return 0; + } } break; case CONFIG_OPTION_TYPE_COLOR: @@ -2375,19 +2721,25 @@ config_file_add_to_infolist (struct t_infolist *infolist, free (option_full_name); return 0; } - if (!infolist_new_var_string (ptr_item, - "value", - gui_color_get_name (CONFIG_COLOR(ptr_option)))) + if (ptr_option->value) { - free (option_full_name); - return 0; + if (!infolist_new_var_string (ptr_item, + "value", + gui_color_get_name (CONFIG_COLOR(ptr_option)))) + { + free (option_full_name); + return 0; + } } - if (!infolist_new_var_string (ptr_item, - "default_value", - gui_color_get_name (CONFIG_COLOR_DEFAULT(ptr_option)))) + if (ptr_option->value) { - free (option_full_name); - return 0; + if (!infolist_new_var_string (ptr_item, + "default_value", + gui_color_get_name (CONFIG_COLOR_DEFAULT(ptr_option)))) + { + free (option_full_name); + return 0; + } } break; case CONFIG_NUM_OPTION_TYPES: @@ -2404,102 +2756,7 @@ config_file_add_to_infolist (struct t_infolist *infolist, } /* - * config_file_print_stdout: print options on standard output - */ - -void -config_file_print_stdout (struct t_config_file *config_file) -{ - struct t_config_section *ptr_section; - struct t_config_option *ptr_option; - const char *color_name; - int i; - - for (ptr_section = config_file->sections; ptr_section; - ptr_section = ptr_section->next_section) - { - for (ptr_option = ptr_section->options; ptr_option; - ptr_option = ptr_option->next_option) - { - string_iconv_fprintf (stdout, - "* %s:\n", - ptr_option->name); - switch (ptr_option->type) - { - case CONFIG_OPTION_TYPE_BOOLEAN: - string_iconv_fprintf (stdout, _(" . type: boolean\n")); - string_iconv_fprintf (stdout, _(" . values: \"on\" or \"off\"\n")); - string_iconv_fprintf (stdout, _(" . default value: \"%s\"\n"), - (CONFIG_BOOLEAN_DEFAULT(ptr_option) == CONFIG_BOOLEAN_TRUE) ? - "on" : "off"); - break; - case CONFIG_OPTION_TYPE_INTEGER: - if (ptr_option->string_values) - { - string_iconv_fprintf (stdout, _(" . type: string\n")); - string_iconv_fprintf (stdout, _(" . values: ")); - i = 0; - while (ptr_option->string_values[i]) - { - string_iconv_fprintf (stdout, "\"%s\"", - ptr_option->string_values[i]); - if (ptr_option->string_values[i + 1]) - string_iconv_fprintf (stdout, ", "); - i++; - } - string_iconv_fprintf (stdout, "\n"); - string_iconv_fprintf (stdout, _(" . default value: \"%s\"\n"), - ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)]); - } - else - { - string_iconv_fprintf (stdout, _(" . type: integer\n")); - string_iconv_fprintf (stdout, _(" . values: between %d and %d\n"), - ptr_option->min, - ptr_option->max); - string_iconv_fprintf (stdout, _(" . default value: %d\n"), - CONFIG_INTEGER_DEFAULT(ptr_option)); - } - break; - case CONFIG_OPTION_TYPE_STRING: - switch (ptr_option->max) - { - case 0: - string_iconv_fprintf (stdout, _(" . type: string\n")); - string_iconv_fprintf (stdout, _(" . values: any string\n")); - break; - case 1: - string_iconv_fprintf (stdout, _(" . type: char\n")); - string_iconv_fprintf (stdout, _(" . values: any char\n")); - break; - default: - string_iconv_fprintf (stdout, _(" . type: string\n")); - string_iconv_fprintf (stdout, _(" . values: any string (limit: %d chars)\n"), - ptr_option->max); - break; - } - string_iconv_fprintf (stdout, _(" . default value: \"%s\"\n"), - CONFIG_STRING_DEFAULT(ptr_option)); - break; - case CONFIG_OPTION_TYPE_COLOR: - color_name = gui_color_get_name (CONFIG_COLOR_DEFAULT(ptr_option)); - string_iconv_fprintf (stdout, _(" . type: color\n")); - string_iconv_fprintf (stdout, _(" . values: color (depends on GUI used)\n")); - string_iconv_fprintf (stdout, _(" . default value: \"%s\"\n"), - color_name); - break; - case CONFIG_NUM_OPTION_TYPES: - break; - } - string_iconv_fprintf (stdout, _(" . description: %s\n"), - _(ptr_option->description)); - string_iconv_fprintf (stdout, "\n"); - } - } -} - -/* - * config_file_print_log: print config in log (usually for crash dump) + * config_file_print_log: print configuration in log (usually for crash dump) */ void @@ -2565,45 +2822,68 @@ config_file_print_log () { case CONFIG_OPTION_TYPE_BOOLEAN: log_printf (" default value. . . . : %s", - (CONFIG_BOOLEAN_DEFAULT(ptr_option) == CONFIG_BOOLEAN_TRUE) ? - "on" : "off"); + (ptr_option->default_value) ? + ((CONFIG_BOOLEAN_DEFAULT(ptr_option) == CONFIG_BOOLEAN_TRUE) ? + "on" : "off") : "null"); log_printf (" value (boolean). . . : %s", - (CONFIG_BOOLEAN(ptr_option) == CONFIG_BOOLEAN_TRUE) ? - "on" : "off"); + (ptr_option->value) ? + ((CONFIG_BOOLEAN(ptr_option) == CONFIG_BOOLEAN_TRUE) ? + "on" : "off") : "null"); break; case CONFIG_OPTION_TYPE_INTEGER: if (ptr_option->string_values) { log_printf (" default value. . . . : '%s'", - ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)]); + (ptr_option->default_value) ? + ptr_option->string_values[CONFIG_INTEGER_DEFAULT(ptr_option)] : "null"); log_printf (" value (integer/str). : '%s'", - ptr_option->string_values[CONFIG_INTEGER(ptr_option)]); + (ptr_option->value) ? + ptr_option->string_values[CONFIG_INTEGER(ptr_option)] : "null"); } else { - log_printf (" default value. . . . : %d", - CONFIG_INTEGER_DEFAULT(ptr_option)); - log_printf (" value (integer). . . : %d", - CONFIG_INTEGER(ptr_option)); + if (ptr_option->default_value) + log_printf (" default value. . . . : %d", + CONFIG_INTEGER_DEFAULT(ptr_option)); + else + log_printf (" default value. . . . : null"); + if (ptr_option->value) + log_printf (" value (integer). . . : %d", + CONFIG_INTEGER(ptr_option)); + else + log_printf (" value (integer). . . : null"); } break; case CONFIG_OPTION_TYPE_STRING: - log_printf (" default value. . . . : '%s'", - CONFIG_STRING_DEFAULT(ptr_option)); - log_printf (" value (string) . . . : '%s'", - CONFIG_STRING(ptr_option)); + if (ptr_option->default_value) + log_printf (" default value. . . . : '%s'", + CONFIG_STRING_DEFAULT(ptr_option)); + else + log_printf (" default value. . . . : null"); + if (ptr_option->value) + log_printf (" value (string) . . . : '%s'", + CONFIG_STRING(ptr_option)); + else + log_printf (" value (string) . . . : null"); break; case CONFIG_OPTION_TYPE_COLOR: - log_printf (" default value. . . . : %d ('%s')", - CONFIG_COLOR_DEFAULT(ptr_option), - gui_color_get_name (CONFIG_COLOR_DEFAULT(ptr_option))); - log_printf (" value (color). . . . : %d ('%s')", - CONFIG_COLOR(ptr_option), - gui_color_get_name (CONFIG_COLOR(ptr_option))); + if (ptr_option->default_value) + log_printf (" default value. . . . : %d ('%s')", + CONFIG_COLOR_DEFAULT(ptr_option), + gui_color_get_name (CONFIG_COLOR_DEFAULT(ptr_option))); + else + log_printf (" default value. . . . : null"); + if (ptr_option->value) + log_printf (" value (color). . . . : %d ('%s')", + CONFIG_COLOR(ptr_option), + gui_color_get_name (CONFIG_COLOR(ptr_option))); + else + log_printf (" value (color). . . . : null"); break; case CONFIG_NUM_OPTION_TYPES: break; } + log_printf (" null_value_allowed . : %d", ptr_option->null_value_allowed); log_printf (" callback_change. . . : 0x%lx", ptr_option->callback_change); log_printf (" loaded . . . . . . . : %d", ptr_option->loaded); log_printf (" prev_option. . . . . : 0x%lx", ptr_option->prev_option); diff --git a/src/core/wee-config-file.h b/src/core/wee-config-file.h index 493b907d1..57da164ce 100644 --- a/src/core/wee-config-file.h +++ b/src/core/wee-config-file.h @@ -119,6 +119,7 @@ struct t_config_option int min, max; /* min and max for value */ void *default_value; /* default value */ void *value; /* value */ + int null_value_allowed; /* null value allowed ? */ int (*callback_check_value) /* called to check value before */ (void *data, /* assiging new value */ struct t_config_option *option, @@ -189,6 +190,7 @@ extern struct t_config_option *config_file_new_option (struct t_config_file *con int min, int max, const char *default_value, const char *value, + int null_value_allowed, int (*callback_check_value)(void *data, struct t_config_option *option, const char *value), @@ -219,18 +221,27 @@ extern int config_file_option_reset (struct t_config_option *option, int run_callback); extern int config_file_option_set (struct t_config_option *option, const char *value, int run_callback); +extern int config_file_option_set_null (struct t_config_option *option, + int run_callback); extern int config_file_option_unset (struct t_config_option *option); extern void config_file_option_rename (struct t_config_option *option, const char *new_name); extern void *config_file_option_get_pointer (struct t_config_option *option, const char *property); +extern int config_file_option_is_null (struct t_config_option *option); +extern int config_file_option_default_is_null (struct t_config_option *option); extern int config_file_option_set_with_string (const char *option_name, const char *value); extern int config_file_option_unset_with_string (const char *option_name); extern int config_file_option_boolean (struct t_config_option *option); +extern int config_file_option_boolean_default (struct t_config_option *option); extern int config_file_option_integer (struct t_config_option *option); +extern int config_file_option_integer_default (struct t_config_option *option); extern const char *config_file_option_string (struct t_config_option *option); +extern const char *config_file_option_string_default (struct t_config_option *option); extern const char *config_file_option_color (struct t_config_option *option); - +extern const char *config_file_option_color_default (struct t_config_option *option); +extern void config_file_write_option (struct t_config_file *config_file, + struct t_config_option *option); extern void config_file_write_line (struct t_config_file *config_file, const char *option_name, const char *value, ...); extern int config_file_write (struct t_config_file *config_files); @@ -245,7 +256,6 @@ extern void config_file_free_all (); extern void config_file_free_all_plugin (struct t_weechat_plugin *plugin); extern int config_file_add_to_infolist (struct t_infolist *infolist, const char *option_name); -extern void config_file_print_stdout (struct t_config_file *config_file); extern void config_file_print_log (); #endif /* wee-config-file.h */ diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 4cf3c801b..9348181ba 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -524,7 +524,7 @@ config_weechat_debug_create_option (void *data, config_file, section, option_name, "integer", _("debug level for plugin (\"core\" for WeeChat core)"), - NULL, 0, 32, "0", value, NULL, NULL, + NULL, 0, 32, "0", value, 0, NULL, NULL, &config_weechat_debug_change, NULL, NULL, NULL); rc = (ptr_option) ? @@ -578,13 +578,13 @@ config_weechat_debug_set (const char *plugin_name, const char *value) } /* - * config_weechat_proxy_read: read proxy option in config file + * config_weechat_proxy_read_cb: read proxy option in config file */ int -config_weechat_proxy_read (void *data, struct t_config_file *config_file, - struct t_config_section *section, - const char *option_name, const char *value) +config_weechat_proxy_read_cb (void *data, struct t_config_file *config_file, + struct t_config_section *section, + const char *option_name, const char *value) { char *pos_option, *proxy_name; struct t_proxy *ptr_temp_proxy; @@ -647,13 +647,13 @@ config_weechat_proxy_read (void *data, struct t_config_file *config_file, } /* - * config_weechat_bar_read: read bar option in config file + * config_weechat_bar_read_cb: read bar option in config file */ int -config_weechat_bar_read (void *data, struct t_config_file *config_file, - struct t_config_section *section, - const char *option_name, const char *value) +config_weechat_bar_read_cb (void *data, struct t_config_file *config_file, + struct t_config_section *section, + const char *option_name, const char *value) { char *pos_option, *bar_name; struct t_gui_bar *ptr_temp_bar; @@ -716,13 +716,13 @@ config_weechat_bar_read (void *data, struct t_config_file *config_file, } /* - * config_weechat_layout_read: read layout option in config file + * config_weechat_layout_read_cb: read layout option in config file */ int -config_weechat_layout_read (void *data, struct t_config_file *config_file, - struct t_config_section *section, - const char *option_name, const char *value) +config_weechat_layout_read_cb (void *data, struct t_config_file *config_file, + struct t_config_section *section, + const char *option_name, const char *value) { int argc; char **argv, *error1, *error2, *error3, *error4; @@ -817,12 +817,12 @@ config_weechat_layout_write_tree (struct t_config_file *config_file, } /* - * config_weechat_layout_write: write layout section in configuration file + * config_weechat_layout_write_cb: write layout section in configuration file */ void -config_weechat_layout_write (void *data, struct t_config_file *config_file, - const char *section_name) +config_weechat_layout_write_cb (void *data, struct t_config_file *config_file, + const char *section_name) { struct t_gui_layout_buffer *ptr_layout_buffer; @@ -845,14 +845,14 @@ config_weechat_layout_write (void *data, struct t_config_file *config_file, } /* - * config_weechat_filter_read: read filter option from config file + * config_weechat_filter_read_cb: read filter option from config file */ int -config_weechat_filter_read (void *data, - struct t_config_file *config_file, - struct t_config_section *section, - const char *option_name, const char *value) +config_weechat_filter_read_cb (void *data, + struct t_config_file *config_file, + struct t_config_section *section, + const char *option_name, const char *value) { char **argv, **argv_eol; int argc; @@ -881,12 +881,12 @@ config_weechat_filter_read (void *data, } /* - * config_weechat_filter_write: write filter section in configuration file + * config_weechat_filter_write_cb: write filter section in configuration file */ void -config_weechat_filter_write (void *data, struct t_config_file *config_file, - const char *section_name) +config_weechat_filter_write_cb (void *data, struct t_config_file *config_file, + const char *section_name) { struct t_gui_filter *ptr_filter; @@ -909,13 +909,13 @@ config_weechat_filter_write (void *data, struct t_config_file *config_file, } /* - * config_weechat_key_read: read key option in config file + * config_weechat_key_read_cb: read key option in config file */ int -config_weechat_key_read (void *data, struct t_config_file *config_file, - struct t_config_section *section, - const char *option_name, const char *value) +config_weechat_key_read_cb (void *data, struct t_config_file *config_file, + struct t_config_section *section, + const char *option_name, const char *value) { /* make C compiler happy */ (void) data; @@ -940,12 +940,12 @@ config_weechat_key_read (void *data, struct t_config_file *config_file, } /* - * config_weechat_key_write: write key section in configuration file + * config_weechat_key_write_cb: write key section in configuration file */ void -config_weechat_key_write (void *data, struct t_config_file *config_file, - const char *section_name) +config_weechat_key_write_cb (void *data, struct t_config_file *config_file, + const char *section_name) { struct t_gui_key *ptr_key; char *expanded_name; @@ -1013,27 +1013,27 @@ config_weechat_init () weechat_config_file, ptr_section, "command_after_plugins", "string", N_("command executed when WeeChat starts, after loading plugins"), - NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_startup_command_before_plugins = config_file_new_option ( weechat_config_file, ptr_section, "command_before_plugins", "string", N_("command executed when WeeChat starts, before loading plugins"), - NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_startup_display_logo = config_file_new_option ( weechat_config_file, ptr_section, "display_logo", "boolean", N_("display WeeChat logo at startup"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_startup_display_version = config_file_new_option ( weechat_config_file, ptr_section, "display_version", "boolean", N_("display WeeChat version at startup"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_startup_weechat_slogan = config_file_new_option ( weechat_config_file, ptr_section, "weechat_slogan", "string", N_("WeeChat slogan (if empty, slogan is not used)"), - NULL, 0, 0, _("the geekiest chat client!"), NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, _("the geekiest chat client!"), NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* look */ ptr_section = config_file_new_section (weechat_config_file, "look", @@ -1052,18 +1052,18 @@ config_weechat_init () N_("default notify level for buffers (used to tell WeeChat if buffer " "must be displayed in hotlist or not, according to importance " "of message)"), - "none|highlight|message|all", 0, 0, "all", NULL, + "none|highlight|message|all", 0, 0, "all", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_look_buffer_time_format = config_file_new_option ( weechat_config_file, ptr_section, "buffer_time_format", "string", N_("time format for buffers"), - NULL, 0, 0, "%H:%M:%S", NULL, NULL, NULL, &config_change_buffer_time_format, NULL, NULL, NULL); + NULL, 0, 0, "%H:%M:%S", NULL, 0, NULL, NULL, &config_change_buffer_time_format, NULL, NULL, NULL); config_look_color_nicks_number = config_file_new_option ( weechat_config_file, ptr_section, "color_nicks_number", "integer", N_("number of colors to use for nicks colors"), - NULL, 1, 10, "10", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 1, 10, "10", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_look_color_real_white = config_file_new_option ( weechat_config_file, ptr_section, "color_real_white", "boolean", @@ -1072,47 +1072,47 @@ config_weechat_init () "white background, you should turn on this option to " "see real white instead of default term foreground " "color)"), - NULL, 0, 0, "off", NULL, NULL, NULL, &config_change_color, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_look_day_change = config_file_new_option ( weechat_config_file, ptr_section, "day_change", "boolean", N_("display special message when day changes"), - NULL, 0, 0, "on", NULL, NULL, NULL, &config_change_day_change, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, &config_change_day_change, NULL, NULL, NULL); config_look_day_change_time_format = config_file_new_option ( weechat_config_file, ptr_section, "day_change_time_format", "string", N_("time format for date displayed when day changed"), - NULL, 0, 0, "%a, %d %b %Y", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "%a, %d %b %Y", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_look_highlight = config_file_new_option ( weechat_config_file, ptr_section, "highlight", "string", N_("comma separated list of words to highlight (case insensitive " "comparison, words may begin or end with \"*\" for partial match)"), - NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_look_hotlist_names_count = config_file_new_option ( weechat_config_file, ptr_section, "hotlist_names_count", "integer", N_("max number of names in hotlist (0 = no name " "displayed, only buffer numbers)"), - NULL, 0, 32, "3", NULL, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL); + NULL, 0, 32, "3", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL); config_look_hotlist_names_length = config_file_new_option ( weechat_config_file, ptr_section, "hotlist_names_length", "integer", N_("max length of names in hotlist (0 = no limit)"), - NULL, 0, 32, "0", NULL, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL); + NULL, 0, 32, "0", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL); config_look_hotlist_names_level = config_file_new_option ( weechat_config_file, ptr_section, "hotlist_names_level", "integer", N_("level for displaying names in hotlist (combination " "of: 1=join/part, 2=message, 4=private, 8=highlight, " "for example: 12=private+highlight)"), - NULL, 1, 15, "12", NULL, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL); + NULL, 1, 15, "12", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL); config_look_hotlist_short_names = config_file_new_option ( weechat_config_file, ptr_section, "hotlist_short_names", "boolean", N_("if set, uses short names to display buffer names in hotlist (start " "after first '.' in name)"), - NULL, 0, 0, "on", NULL, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL); config_look_hotlist_sort = config_file_new_option ( weechat_config_file, ptr_section, "hotlist_sort", "integer", @@ -1121,102 +1121,102 @@ config_weechat_init () "number_asc, number_desc)"), "group_time_asc|group_time_desc|group_number_asc|" "group_number_desc|number_asc|number_desc", - 0, 0, "group_time_asc", NULL, NULL, NULL, &config_change_hotlist, NULL, NULL, NULL); + 0, 0, "group_time_asc", NULL, 0, NULL, NULL, &config_change_hotlist, NULL, NULL, NULL); config_look_item_time_format = config_file_new_option ( weechat_config_file, ptr_section, "item_time_format", "string", N_("time format for \"time\" bar item"), - NULL, 0, 0, "%H:%M", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "%H:%M", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_look_nickmode = config_file_new_option ( weechat_config_file, ptr_section, "nickmode", "boolean", N_("display nick mode ((half)op/voice) before each nick"), - NULL, 0, 0, "on", NULL, NULL, NULL, &config_change_buffers, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL); config_look_nickmode_empty = config_file_new_option ( weechat_config_file, ptr_section, "nickmode_empty", "boolean", N_("display space if nick mode is not (half)op/voice"), - NULL, 0, 0, "off", NULL, NULL, NULL, &config_change_buffers, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL); config_look_paste_max_lines = config_file_new_option ( weechat_config_file, ptr_section, "paste_max_lines", "integer", N_("max number of lines for paste without asking user " "(0 = disable this feature)"), - NULL, 0, INT_MAX, "3", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, INT_MAX, "3", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_look_prefix[GUI_CHAT_PREFIX_ERROR] = config_file_new_option ( weechat_config_file, ptr_section, "prefix_error", "string", N_("prefix for error messages"), - NULL, 0, 0, "=!=", NULL, NULL, NULL, &config_change_prefix, NULL, NULL, NULL); + NULL, 0, 0, "=!=", NULL, 0, NULL, NULL, &config_change_prefix, NULL, NULL, NULL); config_look_prefix[GUI_CHAT_PREFIX_NETWORK] = config_file_new_option ( weechat_config_file, ptr_section, "prefix_network", "string", N_("prefix for network messages"), - NULL, 0, 0, "--", NULL, NULL, NULL, &config_change_prefix, NULL, NULL, NULL); + NULL, 0, 0, "--", NULL, 0, NULL, NULL, &config_change_prefix, NULL, NULL, NULL); config_look_prefix[GUI_CHAT_PREFIX_ACTION] = config_file_new_option ( weechat_config_file, ptr_section, "prefix_action", "string", N_("prefix for action messages"), - NULL, 0, 0, " *", NULL, NULL, NULL, &config_change_prefix, NULL, NULL, NULL); + NULL, 0, 0, " *", NULL, 0, NULL, NULL, &config_change_prefix, NULL, NULL, NULL); config_look_prefix[GUI_CHAT_PREFIX_JOIN] = config_file_new_option ( weechat_config_file, ptr_section, "prefix_join", "string", N_("prefix for join messages"), - NULL, 0, 0, "-->", NULL, NULL, NULL, &config_change_prefix, NULL, NULL, NULL); + NULL, 0, 0, "-->", NULL, 0, NULL, NULL, &config_change_prefix, NULL, NULL, NULL); config_look_prefix[GUI_CHAT_PREFIX_QUIT] = config_file_new_option ( weechat_config_file, ptr_section, "prefix_quit", "string", N_("prefix for quit messages"), - NULL, 0, 0, "<--", NULL, NULL, NULL, &config_change_prefix, NULL, NULL, NULL); + NULL, 0, 0, "<--", NULL, 0, NULL, NULL, &config_change_prefix, NULL, NULL, NULL); config_look_prefix_align = config_file_new_option ( weechat_config_file, ptr_section, "prefix_align", "integer", N_("prefix alignment (none, left, right (default))"), - "none|left|right", 0, 0, "right", NULL, NULL, NULL, &config_change_buffers, NULL, NULL, NULL); + "none|left|right", 0, 0, "right", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL); config_look_prefix_align_max = config_file_new_option ( weechat_config_file, ptr_section, "prefix_align_max", "integer", N_("max size for prefix (0 = no max size)"), - NULL, 0, 64, "0", NULL, NULL, NULL, &config_change_buffers, NULL, NULL, NULL); + NULL, 0, 64, "0", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL); config_look_prefix_suffix = config_file_new_option ( weechat_config_file, ptr_section, "prefix_suffix", "string", N_("string displayed after prefix"), - NULL, 0, 0, "|", NULL, NULL, NULL, &config_change_buffers, NULL, NULL, NULL); + NULL, 0, 0, "|", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL); config_look_read_marker = config_file_new_option ( weechat_config_file, ptr_section, "read_marker", "integer", N_("use a marker (line or char) on buffers to show first unread line"), "none|line|dotted-line|char", - 0, 0, "dotted-line", NULL, NULL, NULL, &config_change_read_marker, NULL, NULL, NULL); + 0, 0, "dotted-line", NULL, 0, NULL, NULL, &config_change_read_marker, NULL, NULL, NULL); config_look_save_config_on_exit = config_file_new_option ( weechat_config_file, ptr_section, "save_config_on_exit", "boolean", N_("save configuration file on exit"), - NULL, 0, 0, "on", NULL, NULL, NULL, &config_change_save_config_on_exit, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, &config_change_save_config_on_exit, NULL, NULL, NULL); config_look_save_layout_on_exit = config_file_new_option ( weechat_config_file, ptr_section, "save_layout_on_exit", "integer", N_("save layout on exit (buffers, windows, or both)"), - "none|buffers|windows|all", 0, 0, "all", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + "none|buffers|windows|all", 0, 0, "all", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_look_scroll_amount = config_file_new_option ( weechat_config_file, ptr_section, "scroll_amount", "integer", N_("how many lines to scroll by with scroll_up and " "scroll_down"), - NULL, 1, INT_MAX, "3", NULL, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL); + NULL, 1, INT_MAX, "3", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL); config_look_scroll_page_percent = config_file_new_option ( weechat_config_file, ptr_section, "scroll_page_percent", "integer", N_("percent of screen to scroll when scrolling one page up or down " "(for example 100 means one page, 50 half-page)"), - NULL, 1, 100, "100", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 1, 100, "100", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_look_set_title = config_file_new_option ( weechat_config_file, ptr_section, "set_title", "boolean", N_("set title for window (terminal for Curses GUI) with " "name and version"), - NULL, 0, 0, "on", NULL, NULL, NULL, &config_change_title, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, &config_change_title, NULL, NULL, NULL); /* colors */ ptr_section = config_file_new_section (weechat_config_file, "color", @@ -1234,343 +1234,343 @@ config_weechat_init () weechat_config_file, ptr_section, "separator", "color", N_("background color for window separators (when splitted)"), - NULL, GUI_COLOR_SEPARATOR, 0, "blue", NULL, + NULL, GUI_COLOR_SEPARATOR, 0, "blue", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); /* bar colors */ config_color_bar_more = config_file_new_option ( weechat_config_file, ptr_section, "bar_more", "color", N_("text color for '+' when scrolling bars"), - NULL, -1, 0, "lightmagenta", NULL, + NULL, -1, 0, "lightmagenta", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); /* chat window */ config_color_chat = config_file_new_option ( weechat_config_file, ptr_section, "chat", "color", N_("text color for chat"), - NULL, GUI_COLOR_CHAT, 0, "default", NULL, + NULL, GUI_COLOR_CHAT, 0, "default", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_bg = config_file_new_option ( weechat_config_file, ptr_section, "chat_bg", "color", N_("background color for chat"), - NULL, -1, 0, "default", NULL, + NULL, -1, 0, "default", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_time = config_file_new_option ( weechat_config_file, ptr_section, "chat_time", "color", N_("text color for time in chat window"), - NULL, GUI_COLOR_CHAT_TIME, 0, "default", NULL, + NULL, GUI_COLOR_CHAT_TIME, 0, "default", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_time_delimiters = config_file_new_option ( weechat_config_file, ptr_section, "chat_time_delimiters", "color", N_("text color for time delimiters"), - NULL, GUI_COLOR_CHAT_TIME_DELIMITERS, 0, "brown", NULL, + NULL, GUI_COLOR_CHAT_TIME_DELIMITERS, 0, "brown", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_prefix[GUI_CHAT_PREFIX_ERROR] = config_file_new_option ( weechat_config_file, ptr_section, "chat_prefix_error", "color", N_("text color for error prefix"), - NULL, GUI_COLOR_CHAT_PREFIX_ERROR, 0, "yellow", NULL, + NULL, GUI_COLOR_CHAT_PREFIX_ERROR, 0, "yellow", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_prefix[GUI_CHAT_PREFIX_NETWORK] = config_file_new_option ( weechat_config_file, ptr_section, "chat_prefix_network", "color", N_("text color for network prefix"), - NULL, GUI_COLOR_CHAT_PREFIX_NETWORK, 0, "magenta", NULL, + NULL, GUI_COLOR_CHAT_PREFIX_NETWORK, 0, "magenta", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_prefix[GUI_CHAT_PREFIX_ACTION] = config_file_new_option ( weechat_config_file, ptr_section, "chat_prefix_action", "color", N_("text color for action prefix"), - NULL, GUI_COLOR_CHAT_PREFIX_ACTION, 0, "white", NULL, + NULL, GUI_COLOR_CHAT_PREFIX_ACTION, 0, "white", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_prefix[GUI_CHAT_PREFIX_JOIN] = config_file_new_option ( weechat_config_file, ptr_section, "chat_prefix_join", "color", N_("text color for join prefix"), - NULL, GUI_COLOR_CHAT_PREFIX_JOIN, 0, "lightgreen", NULL, + NULL, GUI_COLOR_CHAT_PREFIX_JOIN, 0, "lightgreen", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_prefix[GUI_CHAT_PREFIX_QUIT] = config_file_new_option ( weechat_config_file, ptr_section, "chat_prefix_quit", "color", N_("text color for quit prefix"), - NULL, GUI_COLOR_CHAT_PREFIX_QUIT, 0, "lightred", NULL, + NULL, GUI_COLOR_CHAT_PREFIX_QUIT, 0, "lightred", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_prefix_more = config_file_new_option ( weechat_config_file, ptr_section, "chat_prefix_more", "color", N_("text color for '+' when prefix is too long"), - NULL, GUI_COLOR_CHAT_PREFIX_MORE, 0, "lightmagenta", NULL, + NULL, GUI_COLOR_CHAT_PREFIX_MORE, 0, "lightmagenta", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_prefix_suffix = config_file_new_option ( weechat_config_file, ptr_section, "chat_prefix_suffix", "color", N_("text color for suffix (after prefix)"), - NULL, GUI_COLOR_CHAT_PREFIX_SUFFIX, 0, "green", NULL, + NULL, GUI_COLOR_CHAT_PREFIX_SUFFIX, 0, "green", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_buffer = config_file_new_option ( weechat_config_file, ptr_section, "chat_buffer", "color", N_("text color for buffer names"), - NULL, GUI_COLOR_CHAT_BUFFER, 0, "white", NULL, + NULL, GUI_COLOR_CHAT_BUFFER, 0, "white", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_server = config_file_new_option ( weechat_config_file, ptr_section, "chat_server", "color", N_("text color for server names"), - NULL, GUI_COLOR_CHAT_SERVER, 0, "brown", NULL, + NULL, GUI_COLOR_CHAT_SERVER, 0, "brown", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_channel = config_file_new_option ( weechat_config_file, ptr_section, "chat_channel", "color", N_("text color for channel names"), - NULL, GUI_COLOR_CHAT_CHANNEL, 0, "white", NULL, + NULL, GUI_COLOR_CHAT_CHANNEL, 0, "white", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick", "color", N_("text color for nicks in chat window"), - NULL, GUI_COLOR_CHAT_NICK, 0, "lightcyan", NULL, + NULL, GUI_COLOR_CHAT_NICK, 0, "lightcyan", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick_self = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick_self", "color", N_("text color for local nick in chat window"), - NULL, GUI_COLOR_CHAT_NICK_SELF, 0, "white", NULL, + NULL, GUI_COLOR_CHAT_NICK_SELF, 0, "white", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick_other = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick_other", "color", N_("text color for other nick in private buffer"), - NULL, GUI_COLOR_CHAT_NICK_OTHER, 0, "cyan", NULL, + NULL, GUI_COLOR_CHAT_NICK_OTHER, 0, "cyan", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick_colors[0] = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick_color01", "color", N_("text color #1 for nick"), - NULL, GUI_COLOR_CHAT_NICK1, 0, "cyan", NULL, + NULL, GUI_COLOR_CHAT_NICK1, 0, "cyan", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick_colors[1] = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick_color02", "color", N_("text color #2 for nick"), - NULL, GUI_COLOR_CHAT_NICK2, 0, "magenta", NULL, + NULL, GUI_COLOR_CHAT_NICK2, 0, "magenta", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick_colors[2] = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick_color03", "color", N_("text color #3 for nick"), - NULL, GUI_COLOR_CHAT_NICK3, 0, "green", NULL, + NULL, GUI_COLOR_CHAT_NICK3, 0, "green", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick_colors[3] = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick_color04", "color", N_("text color #4 for nick"), - NULL, GUI_COLOR_CHAT_NICK4, 0, "brown", NULL, + NULL, GUI_COLOR_CHAT_NICK4, 0, "brown", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick_colors[4] = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick_color05", "color", N_("text color #5 for nick"), - NULL, GUI_COLOR_CHAT_NICK5, 0, "lightblue", NULL, + NULL, GUI_COLOR_CHAT_NICK5, 0, "lightblue", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick_colors[5] = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick_color06", "color", N_("text color #6 for nick"), - NULL, GUI_COLOR_CHAT_NICK6, 0, "default", NULL, + NULL, GUI_COLOR_CHAT_NICK6, 0, "default", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick_colors[6] = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick_color07", "color", N_("text color #7 for nick"), - NULL, GUI_COLOR_CHAT_NICK7, 0, "lightcyan", NULL, + NULL, GUI_COLOR_CHAT_NICK7, 0, "lightcyan", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick_colors[7] = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick_color08", "color", N_("text color #8 for nick"), - NULL, GUI_COLOR_CHAT_NICK8, 0, "lightmagenta", NULL, + NULL, GUI_COLOR_CHAT_NICK8, 0, "lightmagenta", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick_colors[8] = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick_color09", "color", N_("text color #9 for nick"), - NULL, GUI_COLOR_CHAT_NICK9, 0, "lightgreen", NULL, + NULL, GUI_COLOR_CHAT_NICK9, 0, "lightgreen", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_nick_colors[9] = config_file_new_option ( weechat_config_file, ptr_section, "chat_nick_color10", "color", N_("text color #10 for nick"), - NULL, GUI_COLOR_CHAT_NICK10, 0, "blue", NULL, + NULL, GUI_COLOR_CHAT_NICK10, 0, "blue", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_host = config_file_new_option ( weechat_config_file, ptr_section, "chat_host", "color", N_("text color for hostnames"), - NULL, GUI_COLOR_CHAT_HOST, 0, "cyan", NULL, + NULL, GUI_COLOR_CHAT_HOST, 0, "cyan", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_delimiters = config_file_new_option ( weechat_config_file, ptr_section, "chat_delimiters", "color", N_("text color for delimiters"), - NULL, GUI_COLOR_CHAT_DELIMITERS, 0, "green", NULL, + NULL, GUI_COLOR_CHAT_DELIMITERS, 0, "green", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_highlight = config_file_new_option ( weechat_config_file, ptr_section, "chat_highlight", "color", N_("text color for highlighted prefix"), - NULL, GUI_COLOR_CHAT_HIGHLIGHT, 0, "yellow", NULL, + NULL, GUI_COLOR_CHAT_HIGHLIGHT, 0, "yellow", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_highlight_bg = config_file_new_option ( weechat_config_file, ptr_section, "chat_highlight_bg", "color", N_("background color for highlighted prefix"), - NULL, -1, 0, "magenta", NULL, + NULL, -1, 0, "magenta", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_read_marker = config_file_new_option ( weechat_config_file, ptr_section, "chat_read_marker", "color", N_("text color for unread data marker"), - NULL, GUI_COLOR_CHAT_READ_MARKER, 0, "magenta", NULL, + NULL, GUI_COLOR_CHAT_READ_MARKER, 0, "magenta", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_read_marker_bg = config_file_new_option ( weechat_config_file, ptr_section, "chat_read_marker_bg", "color", N_("background color for unread data marker"), - NULL, -1, 0, "default", NULL, + NULL, -1, 0, "default", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_text_found = config_file_new_option ( weechat_config_file, ptr_section, "chat_text_found", "color", N_("text color for marker on lines where text sought is found"), - NULL, GUI_COLOR_CHAT_TEXT_FOUND, 0, "yellow", NULL, + NULL, GUI_COLOR_CHAT_TEXT_FOUND, 0, "yellow", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_chat_text_found_bg = config_file_new_option ( weechat_config_file, ptr_section, "chat_text_found_bg", "color", N_("background color for marker on lines where text sought is found"), - NULL, -1, 0, "lightmagenta", NULL, + NULL, -1, 0, "lightmagenta", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); /* status window */ config_color_status_number = config_file_new_option ( weechat_config_file, ptr_section, "status_number", "color", N_("text color for current buffer number in status bar"), - NULL, -1, 0, "yellow", NULL, + NULL, -1, 0, "yellow", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_name = config_file_new_option ( weechat_config_file, ptr_section, "status_name", "color", N_("text color for current buffer name in status bar"), - NULL, -1, 0, "white", NULL, + NULL, -1, 0, "white", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_data_msg = config_file_new_option ( weechat_config_file, ptr_section, "status_data_msg", "color", N_("text color for buffer with new messages (status bar)"), - NULL, -1, 0, "yellow", NULL, + NULL, -1, 0, "yellow", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_data_private = config_file_new_option ( weechat_config_file, ptr_section, "status_data_private", "color", N_("text color for buffer with private message (status bar)"), - NULL, -1, 0, "lightgreen", NULL, + NULL, -1, 0, "lightgreen", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_data_highlight = config_file_new_option ( weechat_config_file, ptr_section, "status_data_highlight", "color", N_("text color for buffer with highlight (status bar)"), - NULL, -1, 0, "lightmagenta", NULL, + NULL, -1, 0, "lightmagenta", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_data_other = config_file_new_option ( weechat_config_file, ptr_section, "status_data_other", "color", N_("text color for buffer with new data (not messages) " "(status bar)"), - NULL, -1, 0, "default", NULL, + NULL, -1, 0, "default", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_more = config_file_new_option ( weechat_config_file, ptr_section, "status_more", "color", N_("text color for buffer with new data (status bar)"), - NULL, -1, 0, "yellow", NULL, + NULL, -1, 0, "yellow", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); /* input window */ config_color_input_nick = config_file_new_option ( weechat_config_file, ptr_section, "input_nick", "color", N_("text color for nick name in input line"), - NULL, -1, 0, "lightcyan", NULL, + NULL, -1, 0, "lightcyan", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_input_text_not_found = config_file_new_option ( weechat_config_file, ptr_section, "input_text_not_found", "color", N_("text color for unsucessful text search in input line"), - NULL, -1, 0, "red", NULL, + NULL, -1, 0, "red", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_input_actions = config_file_new_option ( weechat_config_file, ptr_section, "input_actions", "color", N_("text color for actions in input line"), - NULL, -1, 0, "lightgreen", NULL, + NULL, -1, 0, "lightgreen", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); /* nicklist window */ config_color_nicklist_group = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_group", "color", N_("text color for groups in nicklist"), - NULL, -1, 0, "green", NULL, + NULL, -1, 0, "green", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_away = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_away", "color", N_("text color for away nicknames"), - NULL, -1, 0, "cyan", NULL, + NULL, -1, 0, "cyan", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_prefix1 = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_prefix1", "color", N_("text color for prefix #1 in nicklist"), - NULL, -1, 0, "lightgreen", NULL, + NULL, -1, 0, "lightgreen", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_prefix2 = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_prefix2", "color", N_("text color for prefix #2 in nicklist"), - NULL, -1, 0, "lightmagenta", NULL, + NULL, -1, 0, "lightmagenta", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_prefix3 = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_prefix3", "color", N_("text color for prefix #3 in nicklist"), - NULL, -1, 0, "yellow", NULL, + NULL, -1, 0, "yellow", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_prefix4 = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_prefix4", "color", N_("text color for prefix #4 in nicklist"), - NULL, -1, 0, "blue", NULL, + NULL, -1, 0, "blue", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_prefix5 = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_prefix5", "color", N_("text color for prefix #5 in nicklist"), - NULL, -1, 0, "brown", NULL, + NULL, -1, 0, "brown", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_more = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_more", "color", N_("text color for '+' when scrolling nicks in nicklist"), - NULL, -1, 0, "lightmagenta", NULL, + NULL, -1, 0, "lightmagenta", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_separator = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_separator", "color", N_("text color for nicklist separator"), - NULL, -1, 0, "blue", NULL, + NULL, -1, 0, "blue", NULL, 0, NULL, NULL, &config_change_color, NULL, NULL, NULL); /* completion */ @@ -1588,45 +1588,45 @@ config_weechat_init () weechat_config_file, ptr_section, "nick_completor", "string", N_("string inserted after nick completion"), - NULL, 0, 0, ":", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, ":", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_completion_nick_first_only = config_file_new_option ( weechat_config_file, ptr_section, "nick_first_only", "boolean", N_("complete only with first nick found"), - NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_completion_nick_ignore_chars = config_file_new_option ( weechat_config_file, ptr_section, "nick_ignore_chars", "string", N_("chars ignored for nick completion"), - NULL, 0, 0, "[]-^", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "[]-^", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_completion_partial_completion_alert = config_file_new_option ( weechat_config_file, ptr_section, "partial_completion_alert", "boolean", N_("alert user when a partial completion occurs"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_completion_partial_completion_nick = config_file_new_option ( weechat_config_file, ptr_section, "partial_completion_nick", "boolean", N_("partially complete nicks (stop when many nicks found begin with " "same letters)"), - NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_completion_partial_completion_command = config_file_new_option ( weechat_config_file, ptr_section, "partial_completion_command", "boolean", N_("partially complete command names (stop when many commands found " "begin with same letters)"), - NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_completion_partial_completion_command_arg = config_file_new_option ( weechat_config_file, ptr_section, "partial_completion_command_arg", "boolean", N_("partially complete command arguments (stop when many arguments " "found begin with same prefix)"), - NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_completion_partial_completion_count = config_file_new_option ( weechat_config_file, ptr_section, "partial_completion_count", "boolean", N_("display count for each partial completion in bar item"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* history */ ptr_section = config_file_new_section (weechat_config_file, "history", @@ -1644,24 +1644,24 @@ config_weechat_init () "max_lines", "integer", N_("maximum number of lines in history per buffer " "(0 = unlimited)"), - NULL, 0, INT_MAX, "4096", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, INT_MAX, "4096", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_history_max_commands = config_file_new_option ( weechat_config_file, ptr_section, "max_commands", "integer", N_("maximum number of user commands in history (0 = " "unlimited)"), - NULL, 0, INT_MAX, "100", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, INT_MAX, "100", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_history_display_default = config_file_new_option ( weechat_config_file, ptr_section, "display_default", "integer", N_("maximum number of commands to display by default in " "history listing (0 = unlimited)"), - NULL, 0, INT_MAX, "5", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, INT_MAX, "5", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* proxies */ ptr_section = config_file_new_section (weechat_config_file, "proxy", 0, 0, - &config_weechat_proxy_read, NULL, + &config_weechat_proxy_read_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) @@ -1690,13 +1690,13 @@ config_weechat_init () "at startup, \"*\" means all plugins found (names may " "be partial, for example \"perl\" is ok for " "\"perl.so\")"), - NULL, 0, 0, "*", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "*", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_plugin_debug = config_file_new_option ( weechat_config_file, ptr_section, "debug", "boolean", N_("enable debug messages by default in all plugins (option disabled " "by default, which is highly recommended)"), - NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_plugin_extension = config_file_new_option ( weechat_config_file, ptr_section, "extension", "string", @@ -1708,23 +1708,23 @@ config_weechat_init () #else ".so", #endif - NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_plugin_path = config_file_new_option ( weechat_config_file, ptr_section, "path", "string", N_("path for searching plugins ('%h' will be replaced by " "WeeChat home, ~/.weechat by default)"), - NULL, 0, 0, "%h/plugins", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "%h/plugins", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); config_plugin_save_config_on_unload = config_file_new_option ( weechat_config_file, ptr_section, "save_config_on_unload", "boolean", N_("save configuration files when unloading plugins"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* bars */ ptr_section = config_file_new_section (weechat_config_file, "bar", 0, 0, - &config_weechat_bar_read, NULL, + &config_weechat_bar_read_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) @@ -1738,8 +1738,8 @@ config_weechat_init () /* layout */ ptr_section = config_file_new_section (weechat_config_file, "layout", 0, 0, - &config_weechat_layout_read, NULL, - &config_weechat_layout_write, NULL, + &config_weechat_layout_read_cb, NULL, + &config_weechat_layout_write_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) { @@ -1750,9 +1750,9 @@ config_weechat_init () /* filters */ ptr_section = config_file_new_section (weechat_config_file, "filter", 0, 0, - &config_weechat_filter_read, NULL, - &config_weechat_filter_write, NULL, - &config_weechat_filter_write, NULL, + &config_weechat_filter_read_cb, NULL, + &config_weechat_filter_write_cb, NULL, + &config_weechat_filter_write_cb, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) { @@ -1763,9 +1763,9 @@ config_weechat_init () /* keys */ ptr_section = config_file_new_section (weechat_config_file, "key", 0, 0, - &config_weechat_key_read, NULL, - &config_weechat_key_write, NULL, - &config_weechat_key_write, NULL, + &config_weechat_key_read_cb, NULL, + &config_weechat_key_write_cb, NULL, + &config_weechat_key_write_cb, NULL, NULL, NULL, NULL, NULL); if (!ptr_section) { diff --git a/src/core/wee-proxy.c b/src/core/wee-proxy.c index 5c25c3431..de01fba7c 100644 --- a/src/core/wee-proxy.c +++ b/src/core/wee-proxy.c @@ -264,7 +264,7 @@ proxy_create_option (const char *proxy_name, int index_option, weechat_config_file, weechat_config_section_proxy, option_name, "integer", N_("proxy type (http (default), socks4, socks5)"), - "http|socks4|socks5", 0, 0, value, NULL, + "http|socks4|socks5", 0, 0, value, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); break; case PROXY_OPTION_IPV6: @@ -272,7 +272,7 @@ proxy_create_option (const char *proxy_name, int index_option, weechat_config_file, weechat_config_section_proxy, option_name, "boolean", N_("connect to proxy using ipv6"), - NULL, 0, 0, value, NULL, + NULL, 0, 0, value, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); break; case PROXY_OPTION_ADDRESS: @@ -280,7 +280,7 @@ proxy_create_option (const char *proxy_name, int index_option, weechat_config_file, weechat_config_section_proxy, option_name, "string", N_("proxy server address (IP or hostname)"), - NULL, 0, 0, value, NULL, + NULL, 0, 0, value, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); break; case PROXY_OPTION_PORT: @@ -288,7 +288,7 @@ proxy_create_option (const char *proxy_name, int index_option, weechat_config_file, weechat_config_section_proxy, option_name, "integer", N_("port for connecting to proxy server"), - NULL, 0, 65535, value, NULL, + NULL, 0, 65535, value, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); break; case PROXY_OPTION_USERNAME: @@ -296,7 +296,7 @@ proxy_create_option (const char *proxy_name, int index_option, weechat_config_file, weechat_config_section_proxy, option_name, "string", N_("username for proxy server"), - NULL, 0, 0, value, NULL, + NULL, 0, 0, value, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); break; case PROXY_OPTION_PASSWORD: @@ -304,7 +304,7 @@ proxy_create_option (const char *proxy_name, int index_option, weechat_config_file, weechat_config_section_proxy, option_name, "string", N_("password for proxy server"), - NULL, 0, 0, value, NULL, + NULL, 0, 0, value, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); break; case PROXY_NUM_OPTIONS: diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index 8dc03df39..8f6823ac0 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -1300,7 +1300,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value weechat_config_file, weechat_config_section_bar, option_name, "boolean", N_("true if bar is hidden, false if it is displayed"), - NULL, 0, 0, value, NULL, + NULL, 0, 0, value, NULL, 0, NULL, NULL, &gui_bar_config_change_hidden, NULL, NULL, NULL); break; case GUI_BAR_OPTION_PRIORITY: @@ -1308,7 +1308,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value weechat_config_file, weechat_config_section_bar, option_name, "integer", N_("bar priority (high number means bar displayed first)"), - NULL, 0, INT_MAX, value, NULL, + NULL, 0, INT_MAX, value, NULL, 0, NULL, NULL, &gui_bar_config_change_priority, NULL, NULL, NULL); break; case GUI_BAR_OPTION_TYPE: @@ -1316,7 +1316,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value weechat_config_file, weechat_config_section_bar, option_name, "integer", N_("bar type (root, window, window_active, window_inactive)"), - "root|window|window_active|window_inactive", 0, 0, value, NULL, + "root|window|window_active|window_inactive", 0, 0, value, NULL, 0, &gui_bar_config_check_type, NULL, NULL, NULL, NULL, NULL); break; case GUI_BAR_OPTION_CONDITIONS: @@ -1325,7 +1325,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value option_name, "string", N_("condition(s) for displaying bar (for bars of type " "\"window\")"), - NULL, 0, 0, value, NULL, + NULL, 0, 0, value, NULL, 0, NULL, NULL, &gui_bar_config_change_conditions, NULL, NULL, NULL); break; case GUI_BAR_OPTION_POSITION: @@ -1333,7 +1333,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value weechat_config_file, weechat_config_section_bar, option_name, "integer", N_("bar position (bottom, top, left, right)"), - "bottom|top|left|right", 0, 0, value, NULL, + "bottom|top|left|right", 0, 0, value, NULL, 0, NULL, NULL, &gui_bar_config_change_position, NULL, NULL, NULL); break; case GUI_BAR_OPTION_FILLING_TOP_BOTTOM: @@ -1344,7 +1344,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value "right) or \"vertical\" (from top to bottom)) when bar " "position is top or bottom"), "horizontal|vertical|columns_horizontal|columns_vertical", - 0, 0, value, NULL, + 0, 0, value, NULL, 0, NULL, NULL, &gui_bar_config_change_filling, NULL, NULL, NULL); break; case GUI_BAR_OPTION_FILLING_LEFT_RIGHT: @@ -1355,7 +1355,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value "right) or \"vertical\" (from top to bottom)) when bar " "position is left or right"), "horizontal|vertical|columns_horizontal|columns_vertical", - 0, 0, value, NULL, + 0, 0, value, NULL, 0, NULL, NULL, &gui_bar_config_change_filling, NULL, NULL, NULL); break; case GUI_BAR_OPTION_SIZE: @@ -1363,7 +1363,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value weechat_config_file, weechat_config_section_bar, option_name, "integer", N_("bar size in chars (0 = auto size)"), - NULL, 0, INT_MAX, value, NULL, + NULL, 0, INT_MAX, value, NULL, 0, &gui_bar_config_check_size, NULL, &gui_bar_config_change_size, NULL, NULL, NULL); @@ -1373,7 +1373,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value weechat_config_file, weechat_config_section_bar, option_name, "integer", N_("max bar size in chars (0 = no limit)"), - NULL, 0, INT_MAX, value, NULL, + NULL, 0, INT_MAX, value, NULL, 0, NULL, NULL, &gui_bar_config_change_size_max, NULL, NULL, NULL); @@ -1383,7 +1383,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value weechat_config_file, weechat_config_section_bar, option_name, "color", N_("default text color for bar"), - NULL, 0, 0, value, NULL, + NULL, 0, 0, value, NULL, 0, NULL, NULL, &gui_bar_config_change_color, NULL, NULL, NULL); @@ -1393,7 +1393,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value weechat_config_file, weechat_config_section_bar, option_name, "color", N_("default delimiter color for bar"), - NULL, 0, 0, value, NULL, + NULL, 0, 0, value, NULL, 0, NULL, NULL, &gui_bar_config_change_color, NULL, NULL, NULL); @@ -1403,7 +1403,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value weechat_config_file, weechat_config_section_bar, option_name, "color", N_("default background color for bar"), - NULL, 0, 0, value, NULL, + NULL, 0, 0, value, NULL, 0, NULL, NULL, &gui_bar_config_change_color, NULL, NULL, NULL); @@ -1413,7 +1413,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value weechat_config_file, weechat_config_section_bar, option_name, "boolean", N_("separator line between bar and other bars/windows"), - NULL, 0, 0, value, NULL, + NULL, 0, 0, value, NULL, 0, NULL, NULL, &gui_bar_config_change_separator, NULL, NULL, NULL); break; case GUI_BAR_OPTION_ITEMS: @@ -1421,7 +1421,7 @@ gui_bar_create_option (const char *bar_name, int index_option, const char *value weechat_config_file, weechat_config_section_bar, option_name, "string", N_("items of bar"), - NULL, 0, 0, value, NULL, + NULL, 0, 0, value, NULL, 0, NULL, NULL, &gui_bar_config_change_items, NULL, NULL, NULL); break; case GUI_BAR_NUM_OPTIONS: diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index fd09dd4ef..9fe2d8a9d 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -760,66 +760,101 @@ gui_completion_list_add_option_value (struct t_gui_completion *completion) 0, WEECHAT_LIST_POS_SORT); gui_completion_list_add (completion, "toggle", 0, WEECHAT_LIST_POS_END); - if (CONFIG_BOOLEAN(option_found) == CONFIG_BOOLEAN_TRUE) - gui_completion_list_add (completion, "on", - 0, WEECHAT_LIST_POS_BEGINNING); + if (option_found->value) + { + if (CONFIG_BOOLEAN(option_found) == CONFIG_BOOLEAN_TRUE) + gui_completion_list_add (completion, "on", + 0, WEECHAT_LIST_POS_BEGINNING); + else + gui_completion_list_add (completion, "off", + 0, WEECHAT_LIST_POS_BEGINNING); + } else - gui_completion_list_add (completion, "off", + { + gui_completion_list_add (completion, + WEECHAT_CONFIG_OPTION_NULL, 0, WEECHAT_LIST_POS_BEGINNING); + } break; case CONFIG_OPTION_TYPE_INTEGER: - length = 64; - value_string = malloc (length); - if (value_string) + if (option_found->string_values) { - if (option_found->string_values) + for (i = 0; option_found->string_values[i]; i++) { - for (i = 0; option_found->string_values[i]; i++) + gui_completion_list_add (completion, + option_found->string_values[i], + 0, WEECHAT_LIST_POS_SORT); + } + gui_completion_list_add (completion, "++1", + 0, WEECHAT_LIST_POS_END); + gui_completion_list_add (completion, "--1", + 0, WEECHAT_LIST_POS_END); + if (option_found->value) + { + gui_completion_list_add (completion, + option_found->string_values[CONFIG_INTEGER(option_found)], + 0, WEECHAT_LIST_POS_BEGINNING); + } + else + { + gui_completion_list_add (completion, + WEECHAT_CONFIG_OPTION_NULL, + 0, WEECHAT_LIST_POS_BEGINNING); + } + } + else + { + if (option_found->value && CONFIG_INTEGER(option_found) > option_found->min) + gui_completion_list_add (completion, "--1", + 0, WEECHAT_LIST_POS_BEGINNING); + if (option_found->value && CONFIG_INTEGER(option_found) < option_found->max) + gui_completion_list_add (completion, "++1", + 0, WEECHAT_LIST_POS_BEGINNING); + if (option_found->value) + { + value_string = malloc (64); + if (value_string) { + snprintf (value_string, length, + "%d", CONFIG_INTEGER(option_found)); gui_completion_list_add (completion, - option_found->string_values[i], - 0, WEECHAT_LIST_POS_SORT); + value_string, + 0, WEECHAT_LIST_POS_BEGINNING); + free (value_string); } - gui_completion_list_add (completion, "++1", - 0, WEECHAT_LIST_POS_END); - gui_completion_list_add (completion, "--1", - 0, WEECHAT_LIST_POS_END); - snprintf (value_string, length, - "%s", - option_found->string_values[CONFIG_INTEGER(option_found)]); } else { - if (CONFIG_INTEGER(option_found) > option_found->min) - gui_completion_list_add (completion, "--1", - 0, WEECHAT_LIST_POS_BEGINNING); - if (CONFIG_INTEGER(option_found) < option_found->max) - gui_completion_list_add (completion, "++1", - 0, WEECHAT_LIST_POS_BEGINNING); - snprintf (value_string, length, - "%d", CONFIG_INTEGER(option_found)); + gui_completion_list_add (completion, + WEECHAT_CONFIG_OPTION_NULL, + 0, WEECHAT_LIST_POS_BEGINNING); } - gui_completion_list_add (completion, - value_string, - 0, WEECHAT_LIST_POS_BEGINNING); - free (value_string); } break; case CONFIG_OPTION_TYPE_STRING: gui_completion_list_add (completion, "\"\"", 0, WEECHAT_LIST_POS_BEGINNING); - length = strlen (CONFIG_STRING(option_found)) + 2 + 1; - value_string = malloc (length); - if (value_string) + if (option_found->value) + { + length = strlen (CONFIG_STRING(option_found)) + 2 + 1; + value_string = malloc (length); + if (value_string) + { + snprintf (value_string, length, + "\"%s\"", + CONFIG_STRING(option_found)); + gui_completion_list_add (completion, + value_string, + 0, WEECHAT_LIST_POS_BEGINNING); + free (value_string); + } + } + else { - snprintf (value_string, length, - "\"%s\"", - CONFIG_STRING(option_found)); gui_completion_list_add (completion, - value_string, + WEECHAT_CONFIG_OPTION_NULL, 0, WEECHAT_LIST_POS_BEGINNING); - free (value_string); } break; case CONFIG_OPTION_TYPE_COLOR: @@ -836,17 +871,34 @@ gui_completion_list_add_option_value (struct t_gui_completion *completion) 0, WEECHAT_LIST_POS_END); gui_completion_list_add (completion, "--1", 0, WEECHAT_LIST_POS_END); - color_name = gui_color_get_name (CONFIG_INTEGER(option_found)); - if (color_name) + if (option_found->value) + { + color_name = gui_color_get_name (CONFIG_INTEGER(option_found)); + if (color_name) + { + gui_completion_list_add (completion, + color_name, + 0, WEECHAT_LIST_POS_BEGINNING); + } + } + else { gui_completion_list_add (completion, - color_name, + WEECHAT_CONFIG_OPTION_NULL, 0, WEECHAT_LIST_POS_BEGINNING); } break; case CONFIG_NUM_OPTION_TYPES: break; } + if (option_found->value + && option_found->null_value_allowed) + { + gui_completion_list_add (completion, + WEECHAT_CONFIG_OPTION_NULL, + 0, + WEECHAT_LIST_POS_END); + } } } } diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c index f40f9e3e7..da75862a4 100644 --- a/src/plugins/alias/alias.c +++ b/src/plugins/alias/alias.c @@ -631,7 +631,8 @@ alias_config_create_option (void *data, struct t_config_file *config_file, weechat_config_new_option ( config_file, section, option_name, "string", NULL, - NULL, 0, 0, "", value, NULL, NULL, + NULL, 0, 0, "", value, 0, + NULL, NULL, &alias_config_change_cb, NULL, &alias_config_delete_cb, NULL); @@ -750,7 +751,8 @@ alias_command_cb (void *data, struct t_gui_buffer *buffer, int argc, weechat_config_new_option ( alias_config_file, alias_config_section_cmd, alias_name, "string", NULL, - NULL, 0, 0, "", argv_eol[2], NULL, NULL, + NULL, 0, 0, "", argv_eol[2], 0, + NULL, NULL, &alias_config_change_cb, NULL, &alias_config_delete_cb, NULL); diff --git a/src/plugins/aspell/weechat-aspell-config.c b/src/plugins/aspell/weechat-aspell-config.c index 92c254533..a4c94562a 100644 --- a/src/plugins/aspell/weechat-aspell-config.c +++ b/src/plugins/aspell/weechat-aspell-config.c @@ -191,7 +191,8 @@ weechat_aspell_config_dict_create_option (void *data, config_file, section, option_name, "string", _("comma separated list of dictionaries to use on this buffer"), - NULL, 0, 0, "", value, NULL, NULL, + NULL, 0, 0, "", value, 0, + NULL, NULL, &weechat_aspell_config_dict_change, NULL, NULL, NULL); rc = (ptr_option) ? @@ -272,7 +273,7 @@ weechat_aspell_config_init () weechat_aspell_config_file, ptr_section, "color", "color", N_("color used for mispelled words"), - NULL, 0, 0, "lightred", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* check */ ptr_section = weechat_config_new_section (weechat_aspell_config_file, "check", @@ -293,7 +294,7 @@ weechat_aspell_config_init () "enabled (spell checking is disabled for all other commands)"), NULL, 0, 0, "ame,amsg,away,command,cycle,kick,kickban,me,msg,notice,part,query," - "quit,topic", NULL, + "quit,topic", NULL, 0, NULL, NULL, &weechat_aspell_config_change_commands, NULL, NULL, NULL); weechat_aspell_config_check_default_dict = weechat_config_new_option ( weechat_aspell_config_file, ptr_section, @@ -301,19 +302,19 @@ weechat_aspell_config_init () N_("default dictionary (or comma separated list of dictionaries) to " "use when buffer has no dictionary defined (leave blank to disable " "aspell on buffers for which you didn't explicitely enabled it)"), - NULL, 0, 0, "", NULL, + NULL, 0, 0, "", NULL, 0, NULL, NULL, &weechat_aspell_config_change_default_dict, NULL, NULL, NULL); weechat_aspell_config_check_word_min_length = weechat_config_new_option ( weechat_aspell_config_file, ptr_section, "word_min_length", "integer", N_("minimum length for a word to be spell checked (use 0 to check all " "words)"), - NULL, 0, INT_MAX, "2", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, INT_MAX, "2", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); weechat_aspell_config_check_during_search = weechat_config_new_option ( weechat_aspell_config_file, ptr_section, "during_search", "boolean", N_("check words during text search in buffer"), - NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* dict */ ptr_section = weechat_config_new_section (weechat_aspell_config_file, "dict", diff --git a/src/plugins/charset/charset.c b/src/plugins/charset/charset.c index 487fec0ab..78a002ce1 100644 --- a/src/plugins/charset/charset.c +++ b/src/plugins/charset/charset.c @@ -109,7 +109,8 @@ charset_config_create_option (void *data, struct t_config_file *config_file, ptr_option = weechat_config_new_option ( config_file, section, option_name, "string", NULL, - NULL, 0, 0, "", value, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "", value, 0, + NULL, NULL, NULL, NULL, NULL, NULL); rc = (ptr_option) ? WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR; } @@ -163,13 +164,13 @@ charset_config_init () (charset_terminal && charset_internal && (strcasecmp (charset_terminal, charset_internal) != 0)) ? - charset_terminal : "iso-8859-1", NULL, + charset_terminal : "iso-8859-1", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); charset_default_encode = weechat_config_new_option ( charset_config_file, ptr_section, "encode", "string", N_("global encoding charset"), - NULL, 0, 0, "", NULL, + NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); ptr_section = weechat_config_new_section (charset_config_file, "decode", diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index f6cf3abeb..d1ffcf617 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -530,10 +530,8 @@ int irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - struct t_irc_server server_tmp; int i, nb_connect, connect_ok, all_servers, no_join, port, ipv6, ssl; - int default_ipv6, default_ssl; - char *error, value[16]; + char *name, *error; long number; IRC_GET_SERVER(buffer); @@ -606,65 +604,21 @@ irc_command_connect (void *data, struct t_gui_buffer *buffer, int argc, } else { - irc_server_init (&server_tmp); - - default_ipv6 = server_tmp.ipv6; - default_ssl = server_tmp.ssl; - - server_tmp.name = irc_server_get_name_without_port (argv[i]); - server_tmp.addresses = strdup (argv[i]); - server_tmp.ipv6 = ipv6; - server_tmp.ssl = ssl; - - ptr_server = irc_server_new (server_tmp.name, - server_tmp.autoconnect, - server_tmp.autoreconnect, - server_tmp.autoreconnect_delay, - server_tmp.proxy, - server_tmp.addresses, - server_tmp.ipv6, - server_tmp.ssl, - server_tmp.password, - server_tmp.nicks, - server_tmp.username, - server_tmp.realname, - server_tmp.local_hostname, - server_tmp.command, - 1, /* command_delay */ - server_tmp.autojoin, - 1); /* autorejoin */ + name = irc_server_get_name_without_port (argv[i]); + ptr_server = irc_server_alloc ((name) ? name : argv[i]); + if (name) + free (name); if (ptr_server) { + ptr_server->temp_server = 1; + weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_ADDRESSES], + argv[i], 1); weechat_printf (NULL, - _("%s: server %s%s%s created"), + _("%s: server %s%s%s created (temporary server, NOT SAVED!)"), IRC_PLUGIN_NAME, IRC_COLOR_CHAT_SERVER, - server_tmp.name, + ptr_server->name, IRC_COLOR_CHAT); - - /* create server options */ - irc_server_new_option (&server_tmp, - IRC_CONFIG_SERVER_ADDRESSES, - server_tmp.addresses); - if (default_ipv6 != server_tmp.ipv6) - { - snprintf (value, sizeof (value), - "%s", - (server_tmp.ipv6) ? "on" : "off"); - irc_server_new_option (&server_tmp, - IRC_CONFIG_SERVER_IPV6, - value); - } - if (default_ssl != server_tmp.ssl) - { - snprintf (value, sizeof (value), - "%s", - (server_tmp.ssl) ? "on" : "off"); - irc_server_new_option (&server_tmp, - IRC_CONFIG_SERVER_SSL, - value); - } - if (!irc_command_connect_one_server (ptr_server, 0)) connect_ok = 0; } @@ -2776,12 +2730,9 @@ int irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol) { - int i, detailed_list, one_server_found, length; - int default_autoconnect, default_ipv6, default_ssl; - struct t_irc_server server_tmp, *ptr_server2, *server_found, *new_server; - char *server_name, *mask, value[16], charset_modifier[256]; - struct t_infolist *infolist; - struct t_config_option *ptr_option; + int i, detailed_list, one_server_found; + struct t_irc_server *ptr_server2, *server_found, *new_server; + char *server_name, charset_modifier[256]; IRC_GET_SERVER_CHANNEL(buffer); @@ -2852,11 +2803,80 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_OK; } - if (weechat_strcasecmp (argv[1], "rename") == 0) + if (weechat_strcasecmp (argv[1], "add") == 0) { if (argc < 4) { - IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server rename"); + IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server add"); + } + if (irc_server_search (argv[2])) + { + weechat_printf (NULL, + _("%s%s: server \"%s\" already exists, " + "can't create it!"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + argv[2]); + return WEECHAT_RC_ERROR; + } + + new_server = irc_server_alloc (argv[2]); + if (!new_server) + { + weechat_printf (NULL, + _("%s%s: unable to create server"), + weechat_prefix ("error"), IRC_PLUGIN_NAME); + return WEECHAT_RC_ERROR; + } + + weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_ADDRESSES], + argv[3], 1); + + /* parse arguments */ + for (i = 4; i < argc; i++) + { + if (argv[i][0] == '-') + { + if (weechat_strcasecmp (argv[i], "-auto") == 0) + { + weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_AUTOCONNECT], + "on", 1); + } + if (weechat_strcasecmp (argv[i], "-noauto") == 0) + { + weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_AUTOCONNECT], + "off", 1); + } + if (weechat_strcasecmp (argv[i], "-ipv6") == 0) + { + weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_IPV6], + "on", 1); + } + if (weechat_strcasecmp (argv[i], "-ssl") == 0) + { + weechat_config_option_set (new_server->options[IRC_SERVER_OPTION_SSL], + "on", 1); + } + } + } + + weechat_printf (NULL, + _("%s: server %s%s%s created"), + IRC_PLUGIN_NAME, + IRC_COLOR_CHAT_SERVER, + new_server->name, + IRC_COLOR_CHAT); + + if (IRC_SERVER_OPTION_BOOLEAN(new_server, IRC_SERVER_OPTION_AUTOCONNECT)) + irc_server_connect (new_server, 0); + + return WEECHAT_RC_OK; + } + + if (weechat_strcasecmp (argv[1], "copy") == 0) + { + if (argc < 4) + { + IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server copy"); } /* look for server by name */ @@ -2867,7 +2887,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, _("%s%s: server \"%s\" not found for " "\"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[2], "server rename"); + argv[2], "server copy"); return WEECHAT_RC_ERROR; } @@ -2878,15 +2898,16 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, _("%s%s: server \"%s\" already exists for " "\"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[3], "server rename"); + argv[3], "server copy"); return WEECHAT_RC_ERROR; } - /* rename server */ - if (irc_server_rename (server_found, argv[3])) + /* copy server */ + new_server = irc_server_copy (server_found, argv[3]); + if (new_server) { weechat_printf (NULL, - _("%s: server %s%s%s has been renamed to " + _("%s: server %s%s%s has been copied to " "%s%s"), IRC_PLUGIN_NAME, IRC_COLOR_CHAT_SERVER, @@ -2899,130 +2920,60 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, return WEECHAT_RC_ERROR; } - - if (weechat_strcasecmp (argv[1], "add") == 0) + + if (weechat_strcasecmp (argv[1], "rename") == 0) { if (argc < 4) { - IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server add"); + IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server rename"); } - if (irc_server_search (argv[2])) + + /* look for server by name */ + server_found = irc_server_search (argv[2]); + if (!server_found) { weechat_printf (NULL, - _("%s%s: server \"%s\" already exists, " - "can't create it!"), + _("%s%s: server \"%s\" not found for " + "\"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[2]); + argv[2], "server rename"); return WEECHAT_RC_ERROR; } - /* init server struct */ - irc_server_init (&server_tmp); - - default_autoconnect = server_tmp.autoconnect; - default_ipv6 = server_tmp.ipv6; - default_ssl = server_tmp.ssl; - - server_tmp.name = strdup (argv[2]); - server_tmp.addresses = strdup (argv[3]); - - /* parse arguments */ - for (i = 4; i < argc; i++) + /* check if target name already exists */ + if (irc_server_search (argv[3])) { - if (argv[i][0] == '-') - { - if (weechat_strcasecmp (argv[i], "-auto") == 0) - server_tmp.autoconnect = 1; - if (weechat_strcasecmp (argv[i], "-noauto") == 0) - server_tmp.autoconnect = 0; - if (weechat_strcasecmp (argv[i], "-ipv6") == 0) - server_tmp.ipv6 = 1; - if (weechat_strcasecmp (argv[i], "-ssl") == 0) - server_tmp.ssl = 1; - } + weechat_printf (NULL, + _("%s%s: server \"%s\" already exists for " + "\"%s\" command"), + weechat_prefix ("error"), IRC_PLUGIN_NAME, + argv[3], "server rename"); + return WEECHAT_RC_ERROR; } - /* create new server */ - new_server = irc_server_new (server_tmp.name, - server_tmp.autoconnect, - server_tmp.autoreconnect, - server_tmp.autoreconnect_delay, - server_tmp.proxy, - server_tmp.addresses, - server_tmp.ipv6, - server_tmp.ssl, - server_tmp.password, - server_tmp.nicks, - server_tmp.username, - server_tmp.realname, - server_tmp.local_hostname, - server_tmp.command, - 1, /* command_delay */ - server_tmp.autojoin, - 1); /* autorejoin */ - if (new_server) + /* rename server */ + if (irc_server_rename (server_found, argv[3])) { weechat_printf (NULL, - _("%s: server %s%s%s created"), + _("%s: server %s%s%s has been renamed to " + "%s%s"), IRC_PLUGIN_NAME, IRC_COLOR_CHAT_SERVER, - server_tmp.name, - IRC_COLOR_CHAT); - - /* create server options */ - irc_server_new_option (&server_tmp, - IRC_CONFIG_SERVER_ADDRESSES, - server_tmp.addresses); - if (default_autoconnect != server_tmp.autoconnect) - { - snprintf (value, sizeof (value), - "%s", - (server_tmp.autoconnect) ? "on" : "off"); - irc_server_new_option (&server_tmp, - IRC_CONFIG_SERVER_AUTOCONNECT, - value); - } - if (default_ipv6 != server_tmp.ipv6) - { - snprintf (value, sizeof (value), - "%s", - (server_tmp.ipv6) ? "on" : "off"); - irc_server_new_option (&server_tmp, - IRC_CONFIG_SERVER_IPV6, - value); - } - if (default_ssl != server_tmp.ssl) - { - snprintf (value, sizeof (value), - "%s", - (server_tmp.ssl) ? "on" : "off"); - irc_server_new_option (&server_tmp, - IRC_CONFIG_SERVER_SSL, - value); - } - } - else - { - weechat_printf (NULL, - _("%s%s: unable to create server"), - weechat_prefix ("error"), IRC_PLUGIN_NAME); - irc_server_free_data (&server_tmp); - return WEECHAT_RC_ERROR; + argv[2], + IRC_COLOR_CHAT, + IRC_COLOR_CHAT_SERVER, + argv[3]); + return WEECHAT_RC_OK; } - if (new_server->autoconnect) - irc_server_connect (new_server, 0); - - irc_server_free_data (&server_tmp); - - return WEECHAT_RC_OK; + return WEECHAT_RC_ERROR; } - if (weechat_strcasecmp (argv[1], "copy") == 0) + if (weechat_strcasecmp (argv[1], "keep") == 0) { - if (argc < 4) + if (argc < 3) { - IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server copy"); + IRC_COMMAND_TOO_FEW_ARGUMENTS(NULL, "server keep"); } /* look for server by name */ @@ -3033,38 +2984,31 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, _("%s%s: server \"%s\" not found for " "\"%s\" command"), weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[2], "server copy"); + argv[2], "server keep"); return WEECHAT_RC_ERROR; } - /* check if target name already exists */ - if (irc_server_search (argv[3])) + /* check that is it temporary server */ + if (!server_found->temp_server) { weechat_printf (NULL, - _("%s%s: server \"%s\" already exists for " - "\"%s\" command"), + _("%s%s: server \"%s\" is not a temporary server"), weechat_prefix ("error"), IRC_PLUGIN_NAME, - argv[3], "server copy"); + argv[2], "server keep"); return WEECHAT_RC_ERROR; } - /* duplicate server */ - new_server = irc_server_duplicate (server_found, argv[3]); - if (new_server) - { - weechat_printf (NULL, - _("%s: server %s%s%s has been copied to " - "%s%s"), - IRC_PLUGIN_NAME, - IRC_COLOR_CHAT_SERVER, - argv[2], - IRC_COLOR_CHAT, - IRC_COLOR_CHAT_SERVER, - argv[3]); - return WEECHAT_RC_OK; - } + /* remove temporary flag on server */ + server_found->temp_server = 0; - return WEECHAT_RC_ERROR; + weechat_printf (NULL, + _("%s: server %s%s%s is not temporary any more"), + IRC_PLUGIN_NAME, + IRC_COLOR_CHAT_SERVER, + argv[2], + IRC_COLOR_CHAT); + + return WEECHAT_RC_OK; } if (weechat_strcasecmp (argv[1], "del") == 0) @@ -3097,27 +3041,7 @@ irc_command_server (void *data, struct t_gui_buffer *buffer, int argc, } server_name = strdup (server_found->name); - - /* remove all options (server will be removed when last option is removed) */ - length = 32 + strlen (server_found->name) + 1; - mask = malloc (length); - if (mask) - { - snprintf (mask, length, "irc.server.%s.*", server_found->name); - infolist = weechat_infolist_get ("option", NULL, mask); - free (mask); - while (weechat_infolist_next (infolist)) - { - weechat_config_search_with_string (weechat_infolist_string (infolist, - "full_name"), - NULL, NULL, &ptr_option, - NULL); - if (ptr_option) - weechat_config_option_unset (ptr_option); - } - weechat_infolist_free (infolist); - } - + irc_server_free (server_found); weechat_printf (NULL, _("%s: Server %s%s%s has been deleted"), IRC_PLUGIN_NAME, @@ -4114,7 +4038,8 @@ irc_command_init () "[-auto | -noauto] [-ipv6] [-ssl]] | " "[copy servername newservername] | " "[rename servername newservername] | " - "[del servername] | [deloutq] | [switch]"), + "[keep servername] | [del servername] | " + "[deloutq] | [switch]"), N_(" list: list servers (no parameter implies " "this list)\n" " listfull: list servers with detailed info for " @@ -4132,6 +4057,8 @@ irc_command_init () " ssl: use SSL protocol\n" " copy: duplicate a server\n" " rename: rename a server\n" + " keep: keep server in config file (for " + "temporary servers only)\n" " del: delete a server\n" " deloutq: delete messages out queue for all " "servers (all messages WeeChat is currently " @@ -4150,7 +4077,7 @@ irc_command_init () " /server del freenode\n" " /server deloutq\n" " /server switch"), - "add|copy|rename|del|deloutq|list|listfull|switch " + "add|copy|rename|keep|del|deloutq|list|listfull|switch " "%(irc_servers) %(irc_servers)", &irc_command_server, NULL); weechat_hook_command ("servlist", diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index e00a2fe0a..8bf10aa81 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -36,16 +36,6 @@ #include "irc-channel.h" -char *irc_config_server_option_string[IRC_CONFIG_NUM_SERVER_OPTIONS] = -{ "autoconnect", "autoreconnect", "autoreconnect_delay", "proxy", "addresses", - "ipv6", "ssl", "password", "nicks", "username", "realname", "local_hostname", - "command", "command_delay", "autojoin", "autorejoin" -}; -char *irc_config_server_option_default[IRC_CONFIG_NUM_SERVER_OPTIONS] = -{ "off", "on", "30", "", "", "off", "off", "", "", "", "", "", "", "0", "", - "off", "" -}; - struct t_config_file *irc_config_file = NULL; struct t_config_section *irc_config_section_server_default = NULL; struct t_config_section *irc_config_section_server = NULL; @@ -89,36 +79,12 @@ struct t_config_option *irc_config_network_send_unknown_commands; /* IRC config, server section */ -struct t_config_option *irc_config_server_default[IRC_CONFIG_NUM_SERVER_OPTIONS]; +struct t_config_option *irc_config_server_default[IRC_SERVER_NUM_OPTIONS]; struct t_hook *hook_config_color_nicks_number = NULL; +int irc_config_write_temp_servers = 0; -/* - * irc_config_search_server_option: search a server option name - * return index of option in array - * "irc_config_server_option_str", or -1 if - * not found - */ - -int -irc_config_search_server_option (const char *option_name) -{ - int i; - - if (!option_name) - return -1; - - for (i = 0; i < IRC_CONFIG_NUM_SERVER_OPTIONS; i++) - { - if (weechat_strcasecmp (irc_config_server_option_string[i], - option_name) == 0) - return i; - } - - /* server option not found */ - return -1; -} struct t_irc_server * irc_config_get_server_from_option_name (const char *name) @@ -365,32 +331,28 @@ irc_config_change_network_send_unknown_commands (void *data, void irc_config_server_default_change_cb (void *data, struct t_config_option *option) { - int index_option, length; - char *option_full_name; + int index_option; struct t_irc_server *ptr_server; - struct t_config_option *ptr_option; - index_option = irc_config_search_server_option (data); + index_option = irc_server_search_option (data); if (index_option >= 0) { for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - length = strlen (ptr_server->name) + 1 + strlen (data) + 1; - option_full_name = malloc (length); - if (option_full_name) + if (weechat_config_option_is_null (ptr_server->options[index_option])) { - ptr_option = weechat_config_search_option (irc_config_file, - irc_config_section_server, - option_full_name); - if (!ptr_option) + switch (index_option) { - /* option does not exist for server, so we change value - with default value */ - irc_server_set_with_option (ptr_server, index_option, - option); + case IRC_SERVER_OPTION_ADDRESSES: + irc_server_set_addresses (ptr_server, + weechat_config_string (option)); + break; + case IRC_SERVER_OPTION_NICKS: + irc_server_set_nicks (ptr_server, + weechat_config_string (option)); + break; } - free (option_full_name); } } } @@ -407,155 +369,28 @@ irc_config_server_change_cb (void *data, struct t_config_option *option) char *name; struct t_irc_server *ptr_server; - index_option = irc_config_search_server_option (data); + index_option = irc_server_search_option (data); if (index_option >= 0) { name = weechat_config_option_get_pointer (option, "name"); ptr_server = irc_config_get_server_from_option_name (name); if (ptr_server) { - irc_server_set_with_option (ptr_server, index_option, option); - } - } -} - -/* - * irc_config_server_delete_cb: callback called when a server option is deleted - */ - -void -irc_config_server_delete_cb (void *data, struct t_config_option *option) -{ - int i, index_option, length; - char *name, *mask; - struct t_irc_server *ptr_server; - struct t_infolist *infolist; - - index_option = irc_config_search_server_option (data); - if (index_option >= 0) - { - name = weechat_config_option_get_pointer (option, "name"); - ptr_server = irc_config_get_server_from_option_name (name); - if (ptr_server) - { - irc_server_set_with_option (ptr_server, index_option, - irc_config_server_default[index_option]); - - /* look if we should remove server (no more option for server) */ - if (!ptr_server->is_connected) + switch (index_option) { - length = strlen (ptr_server->name) + 64; - mask = malloc (length); - if (mask) - { - snprintf (mask, length, "irc.server.%s.*", - ptr_server->name); - infolist = weechat_infolist_get ("option", NULL, mask); - i = 0; - while (weechat_infolist_next (infolist)) - { - i++; - } - if (i <= 1) - irc_server_free (ptr_server); - weechat_infolist_free (infolist); - free (mask); - } - } - } - } -} - -/* - * irc_config_reload_servers_from_config: create/update servers from options - * read in config file - */ - -void -irc_config_reload_servers_from_config () -{ - struct t_infolist *infolist; - struct t_irc_server *ptr_server; - struct t_config_option *ptr_option; - const char *full_name, *option_name; - char *server_name, *pos_option; - int i, index_option; - - infolist = weechat_infolist_get ("option", NULL, "irc.server.*"); - while (weechat_infolist_next (infolist)) - { - full_name = weechat_infolist_string (infolist, "full_name"); - option_name = weechat_infolist_string (infolist, "option_name"); - if (full_name && option_name) - { - pos_option = strrchr (option_name, '.'); - if (pos_option) - { - server_name = weechat_strndup (option_name, - pos_option - option_name); - if (server_name) - { - pos_option++; - ptr_server = irc_server_search (server_name); - if (!ptr_server) - { - /* create server, it's first time we see it */ - ptr_server = irc_server_alloc (server_name); - if (!ptr_server) - { - weechat_printf (NULL, - _("%s%s: error creating server " - "\"%s\""), - weechat_prefix ("error"), - IRC_PLUGIN_NAME, server_name); - } - } - if (ptr_server) - { - index_option = irc_config_search_server_option (pos_option); - if (index_option >= 0) - { - if (!ptr_server->reloaded_from_config) - { - /* it's first time we see server, and we are - reloading config, then initialize server - with default values (will be overwritten - by config later in this function - */ - for (i = 0; i < IRC_CONFIG_NUM_SERVER_OPTIONS; i++) - { - irc_server_set_with_option (ptr_server, - i, - irc_config_server_default[i]); - } - ptr_server->reloaded_from_config = 1; - } - weechat_config_search_with_string (full_name, NULL, - NULL, &ptr_option, - NULL); - if (ptr_option) - { - irc_server_set_with_option (ptr_server, - index_option, - ptr_option); - } - } - } - else - { - weechat_printf (NULL, - _("%s%s: error creating option " - "\"%s\" for server \"%s\" (server " - "not found)"), - weechat_prefix ("error"), IRC_PLUGIN_NAME, - pos_option, server_name); - } - free (server_name); - } + case IRC_SERVER_OPTION_ADDRESSES: + irc_server_set_addresses (ptr_server, + IRC_SERVER_OPTION_STRING(ptr_server, + IRC_SERVER_OPTION_ADDRESSES)); + break; + case IRC_SERVER_OPTION_NICKS: + irc_server_set_nicks (ptr_server, + IRC_SERVER_OPTION_STRING(ptr_server, + IRC_SERVER_OPTION_NICKS)); + break; } } } - weechat_infolist_free (infolist); } /* @@ -571,11 +406,10 @@ irc_config_reload (void *data, struct t_config_file *config_file) /* make C compiler happy */ (void) data; - weechat_config_section_free_options (irc_config_section_server); - for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { + ptr_server->reloading_from_config = 1; ptr_server->reloaded_from_config = 0; } @@ -583,9 +417,6 @@ irc_config_reload (void *data, struct t_config_file *config_file) rc = weechat_config_reload (config_file); - if (rc == WEECHAT_CONFIG_READ_OK) - irc_config_reload_servers_from_config (1); - ptr_server = irc_servers; while (ptr_server) { @@ -601,9 +432,6 @@ irc_config_reload (void *data, struct t_config_file *config_file) "memory because it's currently used"), weechat_prefix ("error"), IRC_PLUGIN_NAME, ptr_server->name); - /* TODO: create options for server in section (options that - are not default one */ - // ... } else irc_server_free (ptr_server); @@ -616,7 +444,7 @@ irc_config_reload (void *data, struct t_config_file *config_file) } /* - * irc_config_ignore_read: read ignore option from config file + * irc_config_ignore_read: read ignore option from configuration file * return 1 if ok, 0 if error */ @@ -682,20 +510,42 @@ irc_config_ignore_write (void *data, struct t_config_file *config_file, } /* - * irc_config_server_write_default: write default server section in configuration file + * irc_config_server_write_default_cb: write default server section in + * configuration file */ void -irc_config_server_write_default (void *data, struct t_config_file *config_file, - const char *section_name) +irc_config_server_write_default_cb (void *data, + struct t_config_file *config_file, + const char *section_name) { + int i; + char option_name[128]; + /* make C compiler happy */ (void) data; weechat_config_write_line (config_file, section_name, NULL); - weechat_config_write_line (config_file, "freenode.addresses", - "%s", "\"chat.freenode.net/6667\""); + for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++) + { + snprintf (option_name, sizeof (option_name), + "freenode.%s", + irc_server_option_string[i]); + switch (i) + { + case IRC_SERVER_OPTION_ADDRESSES: + weechat_config_write_line (config_file, + option_name, + "%s", "\"chat.freenode.net/6667\""); + break; + default: + weechat_config_write_line (config_file, + option_name, + WEECHAT_CONFIG_OPTION_NULL); + break; + } + } } /* @@ -707,11 +557,11 @@ irc_config_server_new_option (struct t_config_file *config_file, struct t_config_section *section, int index_option, const char *option_name, + const char *default_value, const char *value, + int null_value_allowed, void *callback_change, - void *callback_change_data, - void *callback_delete, - void *callback_delete_data) + void *callback_change_data) { struct t_config_option *new_option; @@ -719,140 +569,152 @@ irc_config_server_new_option (struct t_config_file *config_file, switch (index_option) { - case IRC_CONFIG_SERVER_AUTOCONNECT: + case IRC_SERVER_OPTION_AUTOCONNECT: new_option = weechat_config_new_option ( config_file, section, option_name, "boolean", N_("automatically connect to server when WeeChat is starting"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_AUTORECONNECT: + case IRC_SERVER_OPTION_AUTORECONNECT: new_option = weechat_config_new_option ( config_file, section, option_name, "boolean", N_("automatically reconnect to server when disconnected"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_AUTORECONNECT_DELAY: + case IRC_SERVER_OPTION_AUTORECONNECT_DELAY: new_option = weechat_config_new_option ( config_file, section, option_name, "integer", N_("delay (in seconds) before trying again to reconnect to server"), NULL, 0, 65535, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_PROXY: + case IRC_SERVER_OPTION_PROXY: new_option = weechat_config_new_option ( config_file, section, option_name, "string", N_("proxy used for this server (optional)"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_ADDRESSES: + case IRC_SERVER_OPTION_ADDRESSES: new_option = weechat_config_new_option ( config_file, section, option_name, "string", N_("list of IP/port or hostname/port for server (separated by comma)"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_IPV6: + case IRC_SERVER_OPTION_IPV6: new_option = weechat_config_new_option ( config_file, section, option_name, "boolean", N_("use IPv6 protocol for server communication"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_SSL: + case IRC_SERVER_OPTION_SSL: new_option = weechat_config_new_option ( config_file, section, option_name, "boolean", N_("use SSL for server communication"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_PASSWORD: + case IRC_SERVER_OPTION_PASSWORD: new_option = weechat_config_new_option ( config_file, section, option_name, "string", N_("password for IRC server"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_NICKS: + case IRC_SERVER_OPTION_NICKS: new_option = weechat_config_new_option ( config_file, section, option_name, "string", N_("nicknames to use on IRC server (separated by comma)"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_USERNAME: + case IRC_SERVER_OPTION_USERNAME: new_option = weechat_config_new_option ( config_file, section, option_name, "string", N_("user name to use on IRC server"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_REALNAME: + case IRC_SERVER_OPTION_REALNAME: new_option = weechat_config_new_option ( config_file, section, option_name, "string", N_("real name to use on IRC server"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_LOCAL_HOSTNAME: + case IRC_SERVER_OPTION_LOCAL_HOSTNAME: new_option = weechat_config_new_option ( config_file, section, option_name, "string", N_("custom local hostname/IP for server (optional, if empty " "local hostname is used)"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_COMMAND: + case IRC_SERVER_OPTION_COMMAND: new_option = weechat_config_new_option ( config_file, section, option_name, "string", @@ -860,47 +722,51 @@ irc_config_server_new_option (struct t_config_file *config_file, "be separated by ';', use '\\;' for a semicolon, special variables " "$nick, $channel and $server are replaced by their value)"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_COMMAND_DELAY: + case IRC_SERVER_OPTION_COMMAND_DELAY: new_option = weechat_config_new_option ( config_file, section, option_name, "integer", N_("delay (in seconds) after command was executed (example: give some " "time for authentication)"), NULL, 0, 3600, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_AUTOJOIN: + case IRC_SERVER_OPTION_AUTOJOIN: new_option = weechat_config_new_option ( config_file, section, option_name, "string", N_("comma separated list of channels to join when connected to server " "(example: \"#chan1,#chan2,#chan3 key1,key2\")"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_SERVER_AUTOREJOIN: + case IRC_SERVER_OPTION_AUTOREJOIN: new_option = weechat_config_new_option ( config_file, section, option_name, "boolean", N_("automatically rejoin channels when kicked"), NULL, 0, 0, - irc_config_server_option_default[index_option], value, + default_value, value, + null_value_allowed, NULL, NULL, callback_change, callback_change_data, - callback_delete, callback_delete_data); + NULL, NULL); break; - case IRC_CONFIG_NUM_SERVER_OPTIONS: + case IRC_SERVER_NUM_OPTIONS: break; } @@ -908,21 +774,22 @@ irc_config_server_new_option (struct t_config_file *config_file, } /* - * irc_config_server_create_option: create a server option + * irc_config_server_read_cb: read server option in configuration file */ int -irc_config_server_create_option (void *data, struct t_config_file *config_file, - struct t_config_section *section, - const char *option_name, const char *value) +irc_config_server_read_cb (void *data, struct t_config_file *config_file, + struct t_config_section *section, + const char *option_name, const char *value) { - struct t_config_option *ptr_option; struct t_irc_server *ptr_server; - int rc, index_option; + int index_option, rc, i; char *pos_option, *server_name; /* make C compiler happy */ (void) data; + (void) config_file; + (void) section; rc = WEECHAT_CONFIG_OPTION_SET_ERROR; @@ -936,13 +803,28 @@ irc_config_server_create_option (void *data, struct t_config_file *config_file, pos_option++; if (server_name) { - index_option = irc_config_search_server_option (pos_option); + index_option = irc_server_search_option (pos_option); if (index_option >= 0) { ptr_server = irc_server_search (server_name); if (!ptr_server) ptr_server = irc_server_alloc (server_name); - if (!ptr_server) + if (ptr_server) + { + if (ptr_server->reloading_from_config + && !ptr_server->reloaded_from_config) + { + for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++) + { + weechat_config_option_set (ptr_server->options[i], + NULL, 1); + } + ptr_server->reloaded_from_config = 1; + } + rc = weechat_config_option_set (ptr_server->options[index_option], + value, 1); + } + else { weechat_printf (NULL, _("%s%s: error creating server " @@ -950,39 +832,6 @@ irc_config_server_create_option (void *data, struct t_config_file *config_file, weechat_prefix ("error"), IRC_PLUGIN_NAME, server_name); } - ptr_option = weechat_config_search_option (config_file, - section, - option_name); - if (ptr_option) - { - rc = weechat_config_option_set (ptr_option, value, 1); - } - else - { - if (value && value[0] && (index_option >= 0)) - { - ptr_option = irc_config_server_new_option (config_file, - section, - index_option, - option_name, - value, - &irc_config_server_change_cb, - irc_config_server_option_string[index_option], - &irc_config_server_delete_cb, - irc_config_server_option_string[index_option]); - - if (ptr_option) - { - if (ptr_server) - { - irc_server_set_with_option (ptr_server, - index_option, - ptr_option); - } - rc = WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE; - } - } - } } free (server_name); } @@ -1001,6 +850,36 @@ irc_config_server_create_option (void *data, struct t_config_file *config_file, } /* + * irc_config_server_write_cb: write server section in configuration file + */ + +void +irc_config_server_write_cb (void *data, struct t_config_file *config_file, + const char *section_name) +{ + struct t_irc_server *ptr_server; + int i; + + /* make C compiler happy */ + (void) data; + + weechat_config_write_line (config_file, section_name, NULL); + + for (ptr_server = irc_servers; ptr_server; + ptr_server = ptr_server->next_server) + { + if (!ptr_server->temp_server || irc_config_write_temp_servers) + { + for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++) + { + weechat_config_write_option (config_file, + ptr_server->options[i]); + } + } + } +} + +/* * irc_config_server_create_default_options: create default options for servers */ @@ -1051,28 +930,34 @@ irc_config_server_create_default_options (struct t_config_section *section) realname = strdup ("weechat"); } - for (i = 0; i < IRC_CONFIG_NUM_SERVER_OPTIONS; i++) + for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++) { default_value = NULL; - if (i == IRC_CONFIG_SERVER_NICKS) - default_value = nicks; - else if (i == IRC_CONFIG_SERVER_USERNAME) - default_value = username; - else if (i == IRC_CONFIG_SERVER_REALNAME) - default_value = realname; + switch (i) + { + case IRC_SERVER_OPTION_NICKS: + default_value = nicks; + break; + case IRC_SERVER_OPTION_USERNAME: + default_value = username; + break; + case IRC_SERVER_OPTION_REALNAME: + default_value = realname; + break; + } if (!default_value) - default_value = irc_config_server_option_default[i]; + default_value = irc_server_option_default[i]; irc_config_server_default[i] = irc_config_server_new_option ( irc_config_file, section, i, - irc_config_server_option_string[i], + irc_server_option_string[i], + irc_server_option_default[i], default_value, + 0, &irc_config_server_default_change_cb, - irc_config_server_option_string[i], - NULL, - NULL); + irc_server_option_string[i]); } if (nicks) @@ -1114,80 +999,80 @@ irc_config_init () irc_config_file, ptr_section, "color_nicks_in_server_messages", "boolean", N_("use nick color in messages from server"), - NULL, 0, 0, "on", NULL, NULL, NULL, + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_one_server_buffer = weechat_config_new_option ( irc_config_file, ptr_section, "one_server_buffer", "boolean", N_("use same buffer for all servers"), - NULL, 0, 0, "off", NULL, NULL, NULL, + NULL, 0, 0, "off", NULL, 0, NULL, NULL, &irc_config_change_look_one_server_buffer, NULL, NULL, NULL); irc_config_look_open_near_server = weechat_config_new_option ( irc_config_file, ptr_section, "open_near_server", "boolean", N_("open new channels/privates near server"), - NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_nick_prefix = weechat_config_new_option ( irc_config_file, ptr_section, "nick_prefix", "string", N_("text to display before nick in chat window"), - NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_nick_suffix = weechat_config_new_option ( irc_config_file, ptr_section, "nick_suffix", "string", N_("text to display after nick in chat window"), - NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_nick_completion_smart = weechat_config_new_option ( irc_config_file, ptr_section, "nick_completion_smart", "boolean", N_("smart completion for nicks (completes with last speakers first)"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_display_away = weechat_config_new_option ( irc_config_file, ptr_section, "display_away", "integer", N_("display message when (un)marking as away"), - "off|local|channel", 0, 0, "local", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + "off|local|channel", 0, 0, "local", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_display_channel_modes = weechat_config_new_option ( irc_config_file, ptr_section, "display_channel_modes", "boolean", N_("display channel modes in \"buffer_name\" bar item"), - NULL, 0, 0, "on", NULL, NULL, NULL, + NULL, 0, 0, "on", NULL, 0, NULL, NULL, &irc_config_change_look_display_channel_modes, NULL, NULL, NULL); irc_config_look_hide_nickserv_pwd = weechat_config_new_option ( irc_config_file, ptr_section, "hide_nickserv_pwd", "boolean", N_("hide password displayed by nickserv"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_highlight_tags = weechat_config_new_option ( irc_config_file, ptr_section, "highlight_tags", "string", N_("comma separated list of tags for messages that may produce " "highlight (usually any message from another user, not server " "messages,..)"), - NULL, 0, 0, "irc_privmsg,irc_notice", NULL, NULL, NULL, + NULL, 0, 0, "irc_privmsg,irc_notice", NULL, 0, NULL, NULL, &irc_config_change_look_highlight_tags, NULL, NULL, NULL); irc_config_look_show_away_once = weechat_config_new_option ( irc_config_file, ptr_section, "show_away_once", "boolean", N_("show remote away message only once in private"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_smart_filter = weechat_config_new_option ( irc_config_file, ptr_section, "smart_filter", "boolean", N_("filter join/part/quit messages for a nick if not speaking for " "some minutes on channel (you must create a filter on tag " "\"irc_smart_filter\")"), - NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_smart_filter_delay = weechat_config_new_option ( irc_config_file, ptr_section, "smart_filter_delay", "integer", N_("delay for filtering join/part/quit messages (in minutes)"), - NULL, 1, 60*24*7, "5", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 1, 60*24*7, "5", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_look_notice_as_pv = weechat_config_new_option ( irc_config_file, ptr_section, "notice_as_pv", "boolean", N_("display notices as private messages"), - NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* color */ ptr_section = weechat_config_new_section (irc_config_file, "color", @@ -1205,19 +1090,19 @@ irc_config_init () irc_config_file, ptr_section, "message_join", "color", N_("color for text in join messages"), - NULL, -1, 0, "green", NULL, NULL, NULL, + NULL, -1, 0, "green", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_color_message_quit = weechat_config_new_option ( irc_config_file, ptr_section, "message_quit", "color", N_("color for text in part/quit messages"), - NULL, -1, 0, "red", NULL, NULL, NULL, + NULL, -1, 0, "red", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_color_input_nick = weechat_config_new_option ( irc_config_file, ptr_section, "input_nick", "color", N_("color for nick in input bar"), - NULL, -1, 0, "lightcyan", NULL, NULL, NULL, + NULL, -1, 0, "lightcyan", NULL, 0, NULL, NULL, &irc_config_change_color_input_nick, NULL, NULL, NULL); /* network */ @@ -1237,70 +1122,70 @@ irc_config_init () "default_msg_part", "string", N_("default part message (leaving channel) ('%v' will be replaced by " "WeeChat version in string)"), - NULL, 0, 0, "WeeChat %v", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "WeeChat %v", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_network_default_msg_quit = weechat_config_new_option ( irc_config_file, ptr_section, "default_msg_quit", "string", N_("default quit message (disconnecting from server) ('%v' will be " "replaced by WeeChat version in string)"), - NULL, 0, 0, "WeeChat %v", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "WeeChat %v", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_network_away_check = weechat_config_new_option ( irc_config_file, ptr_section, "away_check", "integer", N_("interval between two checks for away (in minutes, 0 = never " "check)"), - NULL, 0, INT_MAX, "0", NULL, NULL, NULL, + NULL, 0, INT_MAX, "0", NULL, 0, NULL, NULL, &irc_config_change_network_away_check, NULL, NULL, NULL); irc_config_network_away_check_max_nicks = weechat_config_new_option ( irc_config_file, ptr_section, "away_check_max_nicks", "integer", N_("do not check away nicks on channels with high number of nicks " "(0 = unlimited)"), - NULL, 0, INT_MAX, "0", NULL, NULL, NULL, + NULL, 0, INT_MAX, "0", NULL, 0, NULL, NULL, &irc_config_change_network_away_check, NULL, NULL, NULL); irc_config_network_lag_check = weechat_config_new_option ( irc_config_file, ptr_section, "lag_check", "integer", N_("interval between two checks for lag (in seconds, 0 = never " "check)"), - NULL, 0, INT_MAX, "60", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, INT_MAX, "60", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_network_lag_min_show = weechat_config_new_option ( irc_config_file, ptr_section, "lag_min_show", "integer", N_("minimum lag to show (in seconds)"), - NULL, 0, INT_MAX, "1", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, INT_MAX, "1", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_network_lag_disconnect = weechat_config_new_option ( irc_config_file, ptr_section, "lag_disconnect", "integer", N_("disconnect after important lag (in minutes, 0 = never " "disconnect)"), - NULL, 0, INT_MAX, "5", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, INT_MAX, "5", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_network_anti_flood = weechat_config_new_option ( irc_config_file, ptr_section, "anti_flood", "integer", N_("anti-flood: # seconds between two user messages (0 = no " "anti-flood)"), - NULL, 0, 5, "2", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 5, "2", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_network_colors_receive = weechat_config_new_option ( irc_config_file, ptr_section, "colors_receive", "boolean", N_("when off, colors codes are ignored in incoming messages"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_network_colors_send = weechat_config_new_option ( irc_config_file, ptr_section, "colors_send", "boolean", N_("allow user to send colors with special codes (^Cb=bold, " "^Ccxx=color, ^Ccxx,yy=color+background, ^Cu=underline, " "^Cr=reverse)"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); irc_config_network_send_unknown_commands = weechat_config_new_option ( irc_config_file, ptr_section, "send_unknown_commands", "boolean", N_("send unknown commands to IRC server"), - NULL, 0, 0, "off", NULL, NULL, NULL, + NULL, 0, 0, "off", NULL, 0, NULL, NULL, &irc_config_change_network_send_unknown_commands, NULL, NULL, NULL); - /* filters */ + /* ignore */ ptr_section = weechat_config_new_section (irc_config_file, "ignore", 0, 0, &irc_config_ignore_read, NULL, @@ -1331,11 +1216,11 @@ irc_config_init () /* server */ ptr_section = weechat_config_new_section (irc_config_file, "server", - 1, 1, - NULL, NULL, + 0, 0, + &irc_config_server_read_cb, NULL, + &irc_config_server_write_cb, NULL, + &irc_config_server_write_default_cb, NULL, NULL, NULL, - &irc_config_server_write_default, NULL, - &irc_config_server_create_option, NULL, NULL, NULL); if (!ptr_section) { @@ -1374,8 +1259,10 @@ irc_config_read () */ int -irc_config_write () +irc_config_write (int write_temp_servers) { + irc_config_write_temp_servers = write_temp_servers; + return weechat_config_write (irc_config_file); } diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h index 71374071a..e08bf6ef1 100644 --- a/src/plugins/irc/irc-config.h +++ b/src/plugins/irc/irc-config.h @@ -26,29 +26,6 @@ #define IRC_CONFIG_DISPLAY_AWAY_LOCAL 1 #define IRC_CONFIG_DISPLAY_AWAY_CHANNEL 2 -enum t_irc_config_server_option -{ - IRC_CONFIG_SERVER_AUTOCONNECT = 0, - IRC_CONFIG_SERVER_AUTORECONNECT, - IRC_CONFIG_SERVER_AUTORECONNECT_DELAY, - IRC_CONFIG_SERVER_PROXY, - IRC_CONFIG_SERVER_ADDRESSES, - IRC_CONFIG_SERVER_IPV6, - IRC_CONFIG_SERVER_SSL, - IRC_CONFIG_SERVER_PASSWORD, - IRC_CONFIG_SERVER_NICKS, - IRC_CONFIG_SERVER_USERNAME, - IRC_CONFIG_SERVER_REALNAME, - IRC_CONFIG_SERVER_LOCAL_HOSTNAME, - IRC_CONFIG_SERVER_COMMAND, - IRC_CONFIG_SERVER_COMMAND_DELAY, - IRC_CONFIG_SERVER_AUTOJOIN, - IRC_CONFIG_SERVER_AUTOREJOIN, - IRC_CONFIG_SERVER_NOTIFY_LEVELS, - /* number of server options */ - IRC_CONFIG_NUM_SERVER_OPTIONS, -}; - #define IRC_CONFIG_SERVER_DEFAULT_AUTOCONNECT 0 #define IRC_CONFIG_SERVER_DEFAULT_AUTORECONNECT 1 #define IRC_CONFIG_SERVER_DEFAULT_AUTORECONNECT_DELAY 30 @@ -58,7 +35,6 @@ enum t_irc_config_server_option #define IRC_CONFIG_SERVER_DEFAULT_AUTOREJOIN 0 -extern char *irc_config_server_option_string[]; extern struct t_config_file *irc_config_file; extern struct t_config_section *irc_config_section_server_default; extern struct t_config_section *irc_config_section_server; @@ -96,7 +72,6 @@ extern struct t_config_option *irc_config_network_send_unknown_commands; extern struct t_config_option *irc_config_server_default[]; -extern int irc_config_search_server_option (const char *option_name); extern void irc_config_server_change_cb (void *data, struct t_config_option *option); extern void irc_config_server_delete_cb (void *data, @@ -105,14 +80,14 @@ struct t_config_option *irc_config_server_new_option (struct t_config_file *conf struct t_config_section *section, int index_option, const char *option_name, + const char *default_value, const char *value, + int null_value_allowed, void *callback_change, - void *callback_change_data, - void *callback_delete, - void *callback_delete_data); + void *callback_change_data); extern int irc_config_init (); extern int irc_config_read (); -extern int irc_config_write (); +extern int irc_config_write (int write_temp_servers); extern void irc_config_free (); #endif /* irc-config.h */ diff --git a/src/plugins/irc/irc-display.c b/src/plugins/irc/irc-display.c index c221f739e..936e07efb 100644 --- a/src/plugins/irc/irc-display.c +++ b/src/plugins/irc/irc-display.c @@ -152,11 +152,11 @@ irc_display_server (struct t_irc_server *server, int with_detail) { char *string; int num_channels, num_pv; - + if (with_detail) { weechat_printf (NULL, ""); - weechat_printf (NULL, _("%sServer: %s%s %s[%s%s%s]"), + weechat_printf (NULL, _("%sServer: %s%s %s[%s%s%s]%s%s"), IRC_COLOR_CHAT, IRC_COLOR_CHAT_SERVER, server->name, @@ -164,61 +164,150 @@ irc_display_server (struct t_irc_server *server, int with_detail) IRC_COLOR_CHAT, (server->is_connected) ? _("connected") : _("not connected"), - IRC_COLOR_CHAT_DELIMITERS); + IRC_COLOR_CHAT_DELIMITERS, + IRC_COLOR_CHAT, + (server->temp_server) ? _(" (temporary)") : ""); - weechat_printf (NULL, " autoconnect . . . . : %s", - (server->autoconnect) ? _("on") : _("off")); - weechat_printf (NULL, " autoreconnect . . . : %s", - (server->autoreconnect) ? _("on") : _("off")); - weechat_printf (NULL, " autoreconnect_delay : %d %s", - server->autoreconnect_delay, - NG_("second", "seconds", server->autoreconnect_delay)); - weechat_printf (NULL, " addresses . . . . . : %s", - (server->addresses && server->addresses[0]) ? - server->addresses : ""); - weechat_printf (NULL, " ipv6 . . . . . . . : %s", - (server->ipv6) ? _("on") : _("off")); - weechat_printf (NULL, " ssl . . . . . . . . : %s", - (server->ssl) ? _("on") : _("off")); - weechat_printf (NULL, " password . . . . . : %s", - (server->password && server->password[0]) ? - _("(hidden)") : ""); - weechat_printf (NULL, " nicks . . . . . . . : %s", - (server->nicks && server->nicks[0]) ? - server->nicks : ""); - weechat_printf (NULL, " username . . . . . : %s", - (server->username && server->username[0]) ? - server->username : ""); - weechat_printf (NULL, " realname . . . . . : %s", - (server->realname && server->realname[0]) ? - server->realname : ""); - weechat_printf (NULL, " local_hostname . . : %s", - (server->local_hostname && server->local_hostname[0]) ? - server->local_hostname : ""); - if (server->command && server->command[0]) - string = strdup (server->command); - else - string = NULL; - if (string) + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_ADDRESSES])) + weechat_printf (NULL, " addresses. . . . . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_ADDRESSES)); + else + weechat_printf (NULL, " addresses. . . . . . : %s'%s'", + IRC_COLOR_CHAT_HOST, + weechat_config_string (server->options[IRC_SERVER_OPTION_ADDRESSES])); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_PROXY])) + weechat_printf (NULL, " proxy. . . . . . . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY)); + else + weechat_printf (NULL, " proxy. . . . . . . . : %s'%s'", + IRC_COLOR_CHAT_HOST, + weechat_config_string (server->options[IRC_SERVER_OPTION_PROXY])); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_IPV6])) + weechat_printf (NULL, " ipv6 . . . . . . . . : (%s)", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6)) ? + _("on") : _("off")); + else + weechat_printf (NULL, " ipv6 . . . . . . . . : %s%s", + IRC_COLOR_CHAT_HOST, + weechat_config_boolean (server->options[IRC_SERVER_OPTION_IPV6]) ? + _("on") : _("off")); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_SSL])) + weechat_printf (NULL, " ssl. . . . . . . . . : (%s)", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? + _("on") : _("off")); + else + weechat_printf (NULL, " ssl. . . . . . . . . : %s%s", + IRC_COLOR_CHAT_HOST, + weechat_config_boolean (server->options[IRC_SERVER_OPTION_SSL]) ? + _("on") : _("off")); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_PASSWORD])) + weechat_printf (NULL, " password . . . . . . : %s", + _("(hidden)")); + else + weechat_printf (NULL, " password . . . . . . : %s%s", + IRC_COLOR_CHAT_HOST, + _("(hidden)")); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTOCONNECT])) + weechat_printf (NULL, " autoconnect. . . . . : (%s)", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTOCONNECT)) ? + _("on") : _("off")); + else + weechat_printf (NULL, " autoconnect. . . . . : %s%s", + IRC_COLOR_CHAT_HOST, + weechat_config_boolean (server->options[IRC_SERVER_OPTION_AUTOCONNECT]) ? + _("on") : _("off")); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTORECONNECT])) + weechat_printf (NULL, " autoreconnect. . . . : (%s)", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTORECONNECT)) ? + _("on") : _("off")); + else + weechat_printf (NULL, " autoreconnect. . . . : %s%s", + IRC_COLOR_CHAT_HOST, + weechat_config_boolean (server->options[IRC_SERVER_OPTION_AUTORECONNECT]) ? + _("on") : _("off")); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTORECONNECT_DELAY])) + weechat_printf (NULL, " autoreconnect_delay. : (%d %s)", + IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTORECONNECT_DELAY), + NG_("second", "seconds", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTORECONNECT_DELAY))); + else + weechat_printf (NULL, " autoreconnect_delay. : %s%d %s", + IRC_COLOR_CHAT_HOST, + weechat_config_integer (server->options[IRC_SERVER_OPTION_AUTORECONNECT_DELAY]), + NG_("second", "seconds", weechat_config_integer (server->options[IRC_SERVER_OPTION_AUTORECONNECT_DELAY]))); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_NICKS])) + weechat_printf (NULL, " nicks. . . . . . . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_NICKS)); + else + weechat_printf (NULL, " nicks. . . . . . . . : %s'%s'", + IRC_COLOR_CHAT_HOST, + weechat_config_string (server->options[IRC_SERVER_OPTION_NICKS])); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_USERNAME])) + weechat_printf (NULL, " username . . . . . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME)); + else + weechat_printf (NULL, " username . . . . . . : %s'%s'", + IRC_COLOR_CHAT_HOST, + weechat_config_string (server->options[IRC_SERVER_OPTION_USERNAME])); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_REALNAME])) + weechat_printf (NULL, " realname . . . . . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_REALNAME)); + else + weechat_printf (NULL, " realname . . . . . . : %s'%s'", + IRC_COLOR_CHAT_HOST, + weechat_config_string (server->options[IRC_SERVER_OPTION_REALNAME])); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_LOCAL_HOSTNAME])) + weechat_printf (NULL, " local_hostname . . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME)); + else + weechat_printf (NULL, " local_hostname . . . : %s'%s'", + IRC_COLOR_CHAT_HOST, + weechat_config_string (server->options[IRC_SERVER_OPTION_LOCAL_HOSTNAME])); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_COMMAND])) { - if (weechat_config_boolean (irc_config_look_hide_nickserv_pwd)) + string = strdup (IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_COMMAND)); + if (string && weechat_config_boolean (irc_config_look_hide_nickserv_pwd)) irc_display_hide_password (string, 1); - weechat_printf (NULL, " command . . . . . . : %s", - string); - free (string); + weechat_printf (NULL, " command. . . . . . . : ('%s')", + (string) ? string : IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_COMMAND)); + if (string) + free (string); } else { - weechat_printf (NULL, " command . . . . . . : %s", - (server->command && server->command[0]) ? - server->command : ""); + string = strdup (weechat_config_string (server->options[IRC_SERVER_OPTION_COMMAND])); + if (string && weechat_config_boolean (irc_config_look_hide_nickserv_pwd)) + irc_display_hide_password (string, 1); + weechat_printf (NULL, " command. . . . . . . : %s'%s'", + IRC_COLOR_CHAT_HOST, + (string) ? string : weechat_config_string (server->options[IRC_SERVER_OPTION_COMMAND])); + if (string) + free (string); } - weechat_printf (NULL, " command_delay . . . : %d %s", - server->command_delay, - NG_("second", "seconds", server->command_delay)); - weechat_printf (NULL, " autojoin . . . . . : %s", - (server->autojoin && server->autojoin[0]) ? - server->autojoin : ""); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_COMMAND_DELAY])) + weechat_printf (NULL, " command_delay. . . . : (%d %s)", + IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY), + NG_("second", "seconds", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY))); + else + weechat_printf (NULL, " command_delay. . . . : %s%d %s", + IRC_COLOR_CHAT_HOST, + weechat_config_integer (server->options[IRC_SERVER_OPTION_COMMAND_DELAY]), + NG_("second", "seconds", weechat_config_integer (server->options[IRC_SERVER_OPTION_COMMAND_DELAY]))); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTOJOIN])) + weechat_printf (NULL, " autojoin . . . . . . : ('%s')", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_AUTOJOIN)); + else + weechat_printf (NULL, " autojoin . . . . . . : %s'%s'", + IRC_COLOR_CHAT_HOST, + weechat_config_string (server->options[IRC_SERVER_OPTION_AUTOJOIN])); + if (weechat_config_option_is_null (server->options[IRC_SERVER_OPTION_AUTOREJOIN])) + weechat_printf (NULL, " autorejoin . . . . . : (%s)", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTOREJOIN)) ? + _("on") : _("off")); + else + weechat_printf (NULL, " autorejoin . . . . . : %s%s", + IRC_COLOR_CHAT_HOST, + weechat_config_boolean (server->options[IRC_SERVER_OPTION_AUTOREJOIN]) ? + _("on") : _("off")); } else { @@ -226,7 +315,7 @@ irc_display_server (struct t_irc_server *server, int with_detail) { num_channels = irc_server_get_channel_count (server); num_pv = irc_server_get_pv_count (server); - weechat_printf (NULL, " %s %s%s %s[%s%s%s]%s, %d %s, %d pv", + weechat_printf (NULL, " %s %s%s %s[%s%s%s]%s%s, %d %s, %d pv", (server->is_connected) ? "*" : " ", IRC_COLOR_CHAT_SERVER, server->name, @@ -236,16 +325,18 @@ irc_display_server (struct t_irc_server *server, int with_detail) _("connected") : _("not connected"), IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_CHAT, + (server->temp_server) ? _(" (temporary)") : "", num_channels, NG_("channel", "channels", num_channels), num_pv); } else { - weechat_printf (NULL, " %s %s%s", - (server->is_connected) ? "*" : " ", + weechat_printf (NULL, " %s%s%s%s", IRC_COLOR_CHAT_SERVER, - server->name); + server->name, + IRC_COLOR_CHAT, + (server->temp_server) ? _(" (temporary)") : ""); } } } diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 54eb56ca9..ca329edf0 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -456,7 +456,7 @@ irc_protocol_cmd_kick (struct t_irc_server *server, const char *command, /* my nick was kicked => free all nicks, channel is not active any more */ irc_nick_free_all (ptr_channel); - if (server->autorejoin) + if (IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTOREJOIN)) irc_command_join_server (server, ptr_channel->name); } else @@ -1589,7 +1589,8 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, weechat_infolist_new_var_string (item, "local_nick", server->nick); weechat_infolist_new_var_string (item, "filename", pos_file); weechat_infolist_new_var_string (item, "size", pos_size); - weechat_infolist_new_var_string (item, "proxy", server->proxy); + weechat_infolist_new_var_string (item, "proxy", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY)); weechat_infolist_new_var_string (item, "address", pos_addr); weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); weechat_hook_signal_send ("xfer_add", @@ -1922,7 +1923,8 @@ irc_protocol_cmd_privmsg (struct t_irc_server *server, const char *command, weechat_infolist_new_var_string (item, "type", "chat_recv"); weechat_infolist_new_var_string (item, "remote_nick", nick); weechat_infolist_new_var_string (item, "local_nick", server->nick); - weechat_infolist_new_var_string (item, "proxy", server->proxy); + weechat_infolist_new_var_string (item, "proxy", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY)); weechat_infolist_new_var_string (item, "address", pos_addr); weechat_infolist_new_var_integer (item, "port", atoi (pos_port)); weechat_hook_signal_send ("xfer_add", @@ -2382,6 +2384,7 @@ irc_protocol_cmd_001 (struct t_irc_server *server, const char *command, { char **commands, **ptr_cmd, *vars_replaced; char *away_msg; + const char *ptr_command; /* 001 message looks like: :server 001 mynick :Welcome to the dancer-ircd Network @@ -2416,10 +2419,11 @@ irc_protocol_cmd_001 (struct t_irc_server *server, const char *command, WEECHAT_HOOK_SIGNAL_STRING, server->name); /* execute command when connected */ - if (server->command && server->command[0]) + ptr_command = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_COMMAND); + if (ptr_command && ptr_command[0]) { /* splitting command on ';' which can be escaped with '\;' */ - commands = weechat_string_split_command (server->command, ';'); + commands = weechat_string_split_command (ptr_command, ';'); if (commands) { for (ptr_cmd = commands; *ptr_cmd; ptr_cmd++) @@ -2434,7 +2438,7 @@ irc_protocol_cmd_001 (struct t_irc_server *server, const char *command, weechat_string_free_splitted_command (commands); } - if (server->command_delay > 0) + if (IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY) > 0) server->command_time = time (NULL) + 1; else irc_server_autojoin_channels (server); diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index c71e650eb..ed6d10173 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -50,6 +50,17 @@ struct t_irc_server *irc_current_server = NULL; struct t_irc_message *irc_recv_msgq = NULL; struct t_irc_message *irc_msgq_last_msg = NULL; +char *irc_server_option_string[IRC_SERVER_NUM_OPTIONS] = +{ "addresses", "proxy", "ipv6", "ssl", "password", "autoconnect", + "autoreconnect", "autoreconnect_delay", "nicks", "username", "realname", + "local_hostname", "command", "command_delay", "autojoin", "autorejoin" +}; + +char *irc_server_option_default[IRC_SERVER_NUM_OPTIONS] = +{ "", "", "off", "off", "", "off", "on", "30", "", "", "", "", "", "0", "", + "off" +}; + /* * irc_server_valid: check if a server pointer exists @@ -77,6 +88,32 @@ irc_server_valid (struct t_irc_server *server) } /* + * irc_server_search_option: search a server option name + * return index of option in array + * "irc_server_option_string", or -1 if + * not found + */ + +int +irc_server_search_option (const char *option_name) +{ + int i; + + if (!option_name) + return -1; + + for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++) + { + if (weechat_strcasecmp (irc_server_option_string[i], + option_name) == 0) + return i; + } + + /* server option not found */ + return -1; +} + +/* * irc_server_get_name_without_port: get name of server without port * (ends before first '/' if found) */ @@ -97,37 +134,6 @@ irc_server_get_name_without_port (const char *name) } /* - * irc_server_new_option: create option in configuration for a server option - */ - -void -irc_server_new_option (struct t_irc_server *server, int index_option, - const char *value) -{ - int length; - char *option_name; - - length = strlen (server->name) + 1 + - strlen (irc_config_server_option_string[index_option]) + 1; - option_name = malloc (length); - if (option_name) - { - snprintf (option_name, length, "%s.%s", - server->name, - irc_config_server_option_string[index_option]); - irc_config_server_new_option (irc_config_file, - irc_config_section_server, - index_option, - option_name, - value, - &irc_config_server_change_cb, - irc_config_server_option_string[index_option], - &irc_config_server_delete_cb, - irc_config_server_option_string[index_option]); - } -} - -/* * irc_server_set_addresses: set addresses for server */ @@ -139,11 +145,6 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses) long number; /* free data */ - if (server->addresses) - { - free (server->addresses); - server->addresses = NULL; - } server->addresses_count = 0; if (server->addresses_array) { @@ -156,32 +157,28 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses) server->ports_array = NULL; } - /* set new address */ + /* set new addresses/ports */ if (addresses && addresses[0]) { - server->addresses = strdup (addresses); - if (server->addresses) + server->addresses_array = weechat_string_explode (addresses, + ",", 0, 0, + &server->addresses_count); + server->ports_array = malloc (server->addresses_count * sizeof (server->ports_array[0])); + for (i = 0; i < server->addresses_count; i++) { - server->addresses_array = weechat_string_explode (server->addresses, - ",", 0, 0, - &server->addresses_count); - server->ports_array = malloc (server->addresses_count * sizeof (server->ports_array[0])); - for (i = 0; i < server->addresses_count; i++) + pos = strchr (server->addresses_array[i], '/'); + if (pos) { - pos = strchr (server->addresses_array[i], '/'); - if (pos) - { - pos[0] = 0; - pos++; - error = NULL; - number = strtol (pos, &error, 10); - server->ports_array[i] = (error && !error[0]) ? - number : IRC_SERVER_DEFAULT_PORT; - } - else - { - server->ports_array[i] = IRC_SERVER_DEFAULT_PORT; - } + pos[0] = 0; + pos++; + error = NULL; + number = strtol (pos, &error, 10); + server->ports_array[i] = (error && !error[0]) ? + number : IRC_SERVER_DEFAULT_PORT; + } + else + { + server->ports_array[i] = IRC_SERVER_DEFAULT_PORT; } } } @@ -195,11 +192,6 @@ void irc_server_set_nicks (struct t_irc_server *server, const char *nicks) { /* free data */ - if (server->nicks) - { - free (server->nicks); - server->nicks = NULL; - } server->nicks_count = 0; if (server->nicks_array) { @@ -208,94 +200,9 @@ irc_server_set_nicks (struct t_irc_server *server, const char *nicks) } /* set new nicks */ - server->nicks = strdup ((nicks) ? nicks : IRC_SERVER_DEFAULT_NICKS); - if (server->nicks) - { - server->nicks_array = weechat_string_explode (server->nicks, - ",", 0, 0, - &server->nicks_count); - } -} - -/* - * irc_server_set_with_option: set a server option with a config option - */ - -void -irc_server_set_with_option (struct t_irc_server *server, - int index_option, - struct t_config_option *option) -{ - if (!server || !option) - return; - - switch (index_option) - { - case IRC_CONFIG_SERVER_AUTOCONNECT: - server->autoconnect = weechat_config_integer (option); - break; - case IRC_CONFIG_SERVER_AUTORECONNECT: - server->autoreconnect = weechat_config_integer (option); - break; - case IRC_CONFIG_SERVER_AUTORECONNECT_DELAY: - server->autoreconnect_delay = weechat_config_integer (option); - break; - case IRC_CONFIG_SERVER_PROXY: - if (server->proxy) - free (server->proxy); - server->proxy = strdup (weechat_config_string (option)); - break; - case IRC_CONFIG_SERVER_ADDRESSES: - irc_server_set_addresses (server, weechat_config_string (option)); - break; - case IRC_CONFIG_SERVER_IPV6: - server->ipv6 = weechat_config_integer (option); - break; - case IRC_CONFIG_SERVER_SSL: - server->ssl = weechat_config_integer (option); - break; - case IRC_CONFIG_SERVER_PASSWORD: - if (server->password) - free (server->password); - server->password = strdup (weechat_config_string (option)); - break; - case IRC_CONFIG_SERVER_NICKS: - irc_server_set_nicks (server, weechat_config_string (option)); - break; - case IRC_CONFIG_SERVER_USERNAME: - if (server->username) - free (server->username); - server->username = strdup (weechat_config_string (option)); - break; - case IRC_CONFIG_SERVER_REALNAME: - if (server->realname) - free (server->realname); - server->realname = strdup (weechat_config_string (option)); - break; - case IRC_CONFIG_SERVER_LOCAL_HOSTNAME: - if (server->local_hostname) - free (server->local_hostname); - server->local_hostname = strdup (weechat_config_string (option)); - break; - case IRC_CONFIG_SERVER_COMMAND: - if (server->command) - free (server->command); - server->command = strdup (weechat_config_string (option)); - break; - case IRC_CONFIG_SERVER_COMMAND_DELAY: - server->command_delay = weechat_config_integer (option); - break; - case IRC_CONFIG_SERVER_AUTOJOIN: - if (server->autojoin) - free (server->autojoin); - server->autojoin = strdup (weechat_config_string (option)); - break; - case IRC_CONFIG_SERVER_AUTOREJOIN: - server->autorejoin = weechat_config_integer (option); - break; - case IRC_CONFIG_NUM_SERVER_OPTIONS: - break; - } + server->nicks_array = weechat_string_explode ((nicks) ? nicks : IRC_SERVER_DEFAULT_NICKS, + ",", 0, 0, + &server->nicks_count); } /* @@ -325,82 +232,6 @@ irc_server_set_nick (struct t_irc_server *server, const char *nick) } /* - * irc_server_init: init server struct with default values - */ - -void -irc_server_init (struct t_irc_server *server) -{ - int i; - - /* user choices */ - server->name = NULL; - server->autoconnect = IRC_CONFIG_SERVER_DEFAULT_AUTOCONNECT; - server->autoreconnect = IRC_CONFIG_SERVER_DEFAULT_AUTORECONNECT; - server->autoreconnect_delay = IRC_CONFIG_SERVER_DEFAULT_AUTORECONNECT_DELAY; - server->proxy = NULL; - server->addresses = NULL; - server->ipv6 = IRC_CONFIG_SERVER_DEFAULT_IPV6; - server->ssl = IRC_CONFIG_SERVER_DEFAULT_SSL; - server->password = NULL; - server->nicks = NULL; - server->username = NULL; - server->realname = NULL; - server->local_hostname = NULL; - server->command = NULL; - server->command_delay = IRC_CONFIG_SERVER_DEFAULT_COMMAND_DELAY; - server->autojoin = NULL; - server->autorejoin = IRC_CONFIG_SERVER_DEFAULT_AUTOREJOIN; - - /* internal vars */ - server->reloaded_from_config = 0; - server->addresses_count = 0; - server->addresses_array = NULL; - server->ports_array = NULL; - server->index_current_address = 0; - server->current_ip = NULL; - server->sock = -1; - server->hook_connect = NULL; - server->hook_fd = NULL; - server->is_connected = 0; - server->ssl_connected = 0; - server->unterminated_message = NULL; - server->nicks_count = 0; - server->nicks_array = NULL; - server->nick = NULL; - server->nick_modes = NULL; - server->prefix = NULL; - server->reconnect_start = 0; - server->command_time = 0; - server->reconnect_join = 0; - server->disable_autojoin = 0; - server->is_away = 0; - server->away_message = NULL; - server->away_time = 0; - server->lag = 0; - server->lag_check_time.tv_sec = 0; - server->lag_check_time.tv_usec = 0; - server->lag_next_check = time (NULL) + - weechat_config_integer (irc_config_network_lag_check); - server->cmd_list_regexp = NULL; - server->queue_msg = 0; - server->last_user_message = 0; - server->outqueue = NULL; - server->last_outqueue = NULL; - server->buffer = NULL; - server->buffer_as_string = NULL; - server->channels = NULL; - server->last_channel = NULL; - - /* init with default values from config */ - for (i = 0; i < IRC_CONFIG_NUM_SERVER_OPTIONS; i++) - { - irc_server_set_with_option (server, i, - irc_config_server_default[i]); - } -} - -/* * irc_server_alloc: allocate a new server and add it to the servers queue */ @@ -408,12 +239,15 @@ struct t_irc_server * irc_server_alloc (const char *name) { struct t_irc_server *new_server; - + int i, length; + char *option_name; + if (irc_server_search (name)) return NULL; /* alloc memory for new server */ - if ((new_server = malloc (sizeof (*new_server))) == NULL) + new_server = malloc (sizeof (*new_server)); + if (!new_server) { weechat_printf (NULL, _("%s%s: error when allocating new server"), @@ -421,12 +255,6 @@ irc_server_alloc (const char *name) return NULL; } - /* initialize new server */ - irc_server_init (new_server); - - /* set name */ - new_server->name = strdup (name); - /* add new server to queue */ new_server->prev_server = last_irc_server; new_server->next_server = NULL; @@ -435,8 +263,79 @@ irc_server_alloc (const char *name) else irc_servers = new_server; last_irc_server = new_server; - - /* all is ok, return address of new server */ + + /* set name */ + new_server->name = strdup (name); + + /* internal vars */ + new_server->temp_server = 0; + new_server->reloading_from_config = 0; + new_server->reloaded_from_config = 0; + new_server->addresses_count = 0; + new_server->addresses_array = NULL; + new_server->ports_array = NULL; + new_server->index_current_address = 0; + new_server->current_ip = NULL; + new_server->sock = -1; + new_server->hook_connect = NULL; + new_server->hook_fd = NULL; + new_server->is_connected = 0; + new_server->ssl_connected = 0; + new_server->unterminated_message = NULL; + new_server->nicks_count = 0; + new_server->nicks_array = NULL; + new_server->nick = NULL; + new_server->nick_modes = NULL; + new_server->prefix = NULL; + new_server->reconnect_start = 0; + new_server->command_time = 0; + new_server->reconnect_join = 0; + new_server->disable_autojoin = 0; + new_server->is_away = 0; + new_server->away_message = NULL; + new_server->away_time = 0; + new_server->lag = 0; + new_server->lag_check_time.tv_sec = 0; + new_server->lag_check_time.tv_usec = 0; + new_server->lag_next_check = time (NULL) + + weechat_config_integer (irc_config_network_lag_check); + new_server->cmd_list_regexp = NULL; + new_server->queue_msg = 0; + new_server->last_user_message = 0; + new_server->outqueue = NULL; + new_server->last_outqueue = NULL; + new_server->buffer = NULL; + new_server->buffer_as_string = NULL; + new_server->channels = NULL; + new_server->last_channel = NULL; + + /* create options with null value */ + for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++) + { + length = strlen (new_server->name) + 1 + + strlen (irc_server_option_string[i]) + 1; + option_name = malloc (length); + if (option_name) + { + snprintf (option_name, length, "%s.%s", + new_server->name, + irc_server_option_string[i]); + new_server->options[i] = + irc_config_server_new_option (irc_config_file, + irc_config_section_server, + i, + option_name, + NULL, + NULL, + 1, + &irc_config_server_change_cb, + irc_server_option_string[i]); + irc_config_server_change_cb (irc_server_option_string[i], + new_server->options[i]); + free (option_name); + } + } + return new_server; } @@ -452,9 +351,8 @@ irc_server_alloc_with_url (const char *irc_url) { char *irc_url2, *url, *pos_server, *pos_channel, *pos, *pos2; char *password, *nick1, *nicks, *autojoin; - char *default_nicks, *default_password, *default_autojoin, value[16]; char *server_name; - int ipv6, ssl, default_ipv6, default_ssl, length; + int ipv6, ssl, length; struct t_irc_server *ptr_server; irc_url2 = strdup (irc_url); @@ -549,17 +447,16 @@ irc_server_alloc_with_url (const char *irc_url) if (ptr_server) { - irc_server_set_addresses (ptr_server, pos_server); - - default_ipv6 = ptr_server->ipv6; - default_ssl = ptr_server->ssl; - default_nicks = (ptr_server->nicks) ? strdup (ptr_server->nicks) : NULL; - default_password = (ptr_server->password) ? strdup (ptr_server->password) : NULL; - default_autojoin = (ptr_server->autojoin) ? strdup (ptr_server->autojoin) : NULL; - - ptr_server->ipv6 = ipv6; - ptr_server->ssl = ssl; - + ptr_server->temp_server = 1; + weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_ADDRESSES], + pos_server, + 1); + weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_IPV6], + (ipv6) ? "on" : "off", + 1); + weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_SSL], + (ssl) ? "on" : "off", + 1); if (nick1) { length = ((strlen (nick1) + 2) * 5) + 1; @@ -569,57 +466,23 @@ irc_server_alloc_with_url (const char *irc_url) snprintf (nicks, length, "%s,%s1,%s2,%s3,%s4", nick1, nick1, nick1, nick1, nick1); - irc_server_set_nicks (ptr_server, nicks); + weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_NICKS], + nicks, + 1); free (nicks); } } - ptr_server->password = (password) ? strdup (password) : NULL; - ptr_server->autojoin = (autojoin) ? strdup (autojoin) : NULL; - ptr_server->autoconnect = 1; - - /* create server options */ - irc_server_new_option (ptr_server, - IRC_CONFIG_SERVER_ADDRESSES, - ptr_server->addresses); - if (default_ipv6 != ptr_server->ipv6) - { - snprintf (value, sizeof (value), - "%s", - (ptr_server->ipv6) ? "on" : "off"); - irc_server_new_option (ptr_server, - IRC_CONFIG_SERVER_IPV6, - value); - } - if (default_ssl != ptr_server->ssl) - { - snprintf (value, sizeof (value), - "%s", - (ptr_server->ssl) ? "on" : "off"); - irc_server_new_option (ptr_server, - IRC_CONFIG_SERVER_SSL, - value); - } - if (ptr_server->nicks - && (!default_nicks || strcmp (default_nicks, ptr_server->nicks) != 0)) - { - irc_server_new_option (ptr_server, - IRC_CONFIG_SERVER_NICKS, - ptr_server->nicks); - } - if (ptr_server->password - && (!default_password || strcmp (default_password, ptr_server->password) != 0)) - { - irc_server_new_option (ptr_server, - IRC_CONFIG_SERVER_PASSWORD, - ptr_server->password); - } - if (ptr_server->autojoin - && (!default_autojoin || strcmp (default_autojoin, ptr_server->autojoin) != 0)) - { - irc_server_new_option (ptr_server, - IRC_CONFIG_SERVER_AUTOJOIN, - ptr_server->autojoin); - } + if (password) + weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_PASSWORD], + password, + 1); + if (autojoin) + weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_AUTOJOIN], + autojoin, + 1); + weechat_config_option_set (ptr_server->options[IRC_SERVER_OPTION_AUTOCONNECT], + "on", + 1); } else { @@ -723,38 +586,25 @@ irc_server_outqueue_free_all (struct t_irc_server *server) void irc_server_free_data (struct t_irc_server *server) { + int i; + if (!server) return; /* free data */ - if (server->name) - free (server->name); - if (server->proxy) - free (server->proxy); - if (server->addresses) - free (server->addresses); + for (i = 0; i < IRC_SERVER_NUM_OPTIONS; i++) + { + if (server->options[i]) + weechat_config_option_free (server->options[i]); + } if (server->addresses_array) weechat_string_free_exploded (server->addresses_array); if (server->ports_array) free (server->ports_array); if (server->current_ip) free (server->current_ip); - if (server->password) - free (server->password); - if (server->nicks) - free (server->nicks); if (server->nicks_array) weechat_string_free_exploded (server->nicks_array); - if (server->username) - free (server->username); - if (server->realname) - free (server->realname); - if (server->local_hostname) - free (server->local_hostname); - if (server->command) - free (server->command); - if (server->autojoin) - free (server->autojoin); if (server->unterminated_message) free (server->unterminated_message); if (server->nick) @@ -825,7 +675,7 @@ irc_server_free_all () /* * irc_server_new: creates a new server, and initialize it */ - +/* struct t_irc_server * irc_server_new (const char *name, int autoconnect, int autoreconnect, int autoreconnect_delay, const char *proxy, @@ -886,45 +736,26 @@ irc_server_new (const char *name, int autoconnect, int autoreconnect, return new_server; } - +*/ /* - * irc_server_duplicate: duplicate a server - * return: pointer to new server, NULL if error + * irc_server_copy: copy a server + * return: pointer to new server, NULL if error */ struct t_irc_server * -irc_server_duplicate (struct t_irc_server *server, const char *new_server_name) +irc_server_copy (struct t_irc_server *server, const char *new_name) { struct t_irc_server *new_server; - int length, index_option; - char *mask, *pos_option; - const char *option_name; - struct t_config_option *ptr_option; struct t_infolist *infolist; + char *mask, *pos; + const char *option_name; + int length, index_option; /* check if another server exists with this name */ - if (irc_server_search (new_server_name)) + if (irc_server_search (new_name)) return NULL; - /* duplicate server */ - new_server = irc_server_new (new_server_name, - server->autoconnect, - server->autoreconnect, - server->autoreconnect_delay, - server->proxy, - server->addresses, - server->ipv6, - server->ssl, - server->password, - server->nicks, - server->username, - server->realname, - server->local_hostname, - server->command, - server->command_delay, - server->autojoin, - server->autorejoin); - + new_server = irc_server_alloc (new_name); if (new_server) { /* duplicate options */ @@ -937,32 +768,22 @@ irc_server_duplicate (struct t_irc_server *server, const char *new_server_name) free (mask); while (weechat_infolist_next (infolist)) { - weechat_config_search_with_string (weechat_infolist_string (infolist, - "full_name"), - NULL, NULL, &ptr_option, - NULL); - if (ptr_option) + if (!weechat_infolist_integer (infolist, "value_is_null")) { option_name = weechat_infolist_string (infolist, "option_name"); - if (option_name) + pos = strrchr (option_name, '.'); + if (pos) { - pos_option = strrchr (option_name, '.'); - if (pos_option) + index_option = irc_server_search_option (pos + 1); + if (index_option >= 0) { - pos_option++; - - index_option = irc_config_search_server_option (pos_option); - if (index_option >= 0) - { - irc_server_new_option (new_server, - index_option, - weechat_infolist_string (infolist, "value")); - } + weechat_config_option_set (new_server->options[index_option], + weechat_infolist_string (infolist, "value"), + 1); } } } } - weechat_infolist_free (infolist); } return new_server; @@ -1805,7 +1626,8 @@ irc_server_timer_cb (void *data) /* check if reconnection is pending */ if ((!ptr_server->is_connected) && (ptr_server->reconnect_start > 0) - && (new_time >= (ptr_server->reconnect_start + ptr_server->autoreconnect_delay))) + && (new_time >= (ptr_server->reconnect_start + + IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_AUTORECONNECT_DELAY)))) irc_server_reconnect (ptr_server); else { @@ -1825,7 +1647,8 @@ irc_server_timer_cb (void *data) /* check if it's time to autojoin channels (after command delay) */ if ((ptr_server->command_time != 0) - && (new_time >= ptr_server->command_time + ptr_server->command_delay)) + && (new_time >= ptr_server->command_time + + IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_COMMAND_DELAY))) { irc_server_autojoin_channels (ptr_server); ptr_server->command_time = 0; @@ -1936,17 +1759,19 @@ irc_server_close_connection (struct t_irc_server *server) void irc_server_reconnect_schedule (struct t_irc_server *server) { + int delay; + server->index_current_address = 0; - if (server->autoreconnect) + if (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTORECONNECT)) { server->reconnect_start = time (NULL); + delay = IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTORECONNECT_DELAY); weechat_printf (server->buffer, _("%s%s: reconnecting to server in %d %s"), irc_buffer_get_server_prefix (server, NULL), IRC_PLUGIN_NAME, - server->autoreconnect_delay, - NG_("second", "seconds", - server->autoreconnect_delay)); + delay, + NG_("second", "seconds", delay)); } else server->reconnect_start = 0; @@ -1959,25 +1784,31 @@ irc_server_reconnect_schedule (struct t_irc_server *server) void irc_server_login (struct t_irc_server *server) { - if ((server->password) && (server->password[0])) - irc_server_sendf (server, "PASS %s", server->password); + const char *password, *username, *realname; + + password = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PASSWORD); + username = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME); + realname = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_REALNAME); + + if (password && password[0]) + irc_server_sendf (server, "PASS %s", password); if (!server->nick) + { irc_server_set_nick (server, (server->nicks_array) ? server->nicks_array[0] : "weechat"); + } irc_server_sendf (server, "NICK %s\n" "USER %s %s %s :%s", server->nick, - (server->username && server->username[0]) ? - server->username : "weechat", - (server->username && server->username[0]) ? - server->username : "weechat", + (username && username[0]) ? username : "weechat", + (username && username[0]) ? username : "weechat", server->addresses_array[server->index_current_address], - (server->realname && server->realname[0]) ? - server->realname : "weechat"); + (realname && realname[0]) ? + realname : "weechat"); } /* @@ -2012,9 +1843,12 @@ int irc_server_connect_cb (void *arg_server, int status, const char *ip_address) { struct t_irc_server *server; + const char *proxy; server = (struct t_irc_server *)arg_server; + proxy = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY); + server->hook_connect = NULL; switch (status) @@ -2038,7 +1872,7 @@ irc_server_connect_cb (void *arg_server, int status, const char *ip_address) break; case WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND: weechat_printf (server->buffer, - (server->proxy && server->proxy[0]) ? + (proxy && proxy[0]) ? _("%s%s: proxy address \"%s\" not found") : _("%s%s: address \"%s\" not found"), irc_buffer_get_server_prefix (server, "error"), @@ -2049,7 +1883,7 @@ irc_server_connect_cb (void *arg_server, int status, const char *ip_address) break; case WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND: weechat_printf (server->buffer, - (server->proxy && server->proxy[0]) ? + (proxy && proxy[0]) ? _("%s%s: proxy IP address not found") : _("%s%s: IP address not found"), irc_buffer_get_server_prefix (server, "error"), @@ -2059,7 +1893,7 @@ irc_server_connect_cb (void *arg_server, int status, const char *ip_address) break; case WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED: weechat_printf (server->buffer, - (server->proxy && server->proxy[0]) ? + (proxy && proxy[0]) ? _("%s%s: proxy connection refused") : _("%s%s: connection refused"), irc_buffer_get_server_prefix (server, "error"), @@ -2219,7 +2053,7 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin) int set, length; char *option_name, charset_modifier[256]; struct t_config_option *proxy_type, *proxy_ipv6, *proxy_address, *proxy_port; - const char *str_proxy_type, *str_proxy_address; + const char *proxy, *str_proxy_type, *str_proxy_address; proxy_type = NULL; proxy_ipv6 = NULL; @@ -2264,9 +2098,10 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin) "/command irc /server switch"); } - if (server->proxy && server->proxy[0]) + proxy = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY); + if (proxy && proxy[0]) { - length = 32 + strlen (server->proxy) + 1; + length = 32 + strlen (proxy) + 1; option_name = malloc (length); if (!option_name) { @@ -2276,17 +2111,13 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin) IRC_PLUGIN_NAME); return 0; } - snprintf (option_name, length, "weechat.proxy.%s.type", - server->proxy); + snprintf (option_name, length, "weechat.proxy.%s.type", proxy); proxy_type = weechat_config_get (option_name); - snprintf (option_name, length, "weechat.proxy.%s.ipv6", - server->proxy); + snprintf (option_name, length, "weechat.proxy.%s.ipv6", proxy); proxy_ipv6 = weechat_config_get (option_name); - snprintf (option_name, length, "weechat.proxy.%s.address", - server->proxy); + snprintf (option_name, length, "weechat.proxy.%s.address", proxy); proxy_address = weechat_config_get (option_name); - snprintf (option_name, length, "weechat.proxy.%s.port", - server->proxy); + snprintf (option_name, length, "weechat.proxy.%s.port", proxy); proxy_port = weechat_config_get (option_name); free (option_name); if (!proxy_type || !proxy_address) @@ -2295,7 +2126,7 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin) _("%s%s: proxy \"%s\" not found for server " "\"%s\", cannot connect"), irc_buffer_get_server_prefix (server, "error"), - IRC_PLUGIN_NAME, server->proxy, server->name); + IRC_PLUGIN_NAME, proxy, server->name); return 0; } str_proxy_type = weechat_config_string (proxy_type); @@ -2307,12 +2138,12 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin) _("%s%s: missing proxy settings, check options " "for proxy \"%s\""), irc_buffer_get_server_prefix (server, "error"), - IRC_PLUGIN_NAME, server->proxy); + IRC_PLUGIN_NAME, proxy); return 0; } } - if (!server->addresses || !server->addresses[0]) + if (!server->addresses_array) { weechat_printf (server->buffer, _("%s%s: addresses not defined for server \"%s\", " @@ -2322,7 +2153,7 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin) return 0; } - if (!server->nicks || !server->nicks[0]) + if (!server->nicks_array) { weechat_printf (server->buffer, _("%s%s: nicks not defined for server \"%s\", " @@ -2333,7 +2164,7 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin) } #ifndef HAVE_GNUTLS - if (server->ssl) + if (weechat_config_boolean (IRC_SERVER_OPTION(server, IRC_SERVER_OPTION_SSL))) { weechat_printf (server->buffer, _("%s%s: cannot connect with SSL since WeeChat " @@ -2352,8 +2183,10 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin) IRC_PLUGIN_NAME, server->addresses_array[server->index_current_address], server->ports_array[server->index_current_address], - (server->ipv6) ? " (IPv6)" : "", - (server->ssl) ? " (SSL)" : "", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6)) ? + " (IPv6)" : "", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? + " (SSL)" : "", str_proxy_type, str_proxy_address, weechat_config_integer (proxy_port), @@ -2362,8 +2195,10 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin) "%s/%d%s..."), server->addresses_array[server->index_current_address], server->ports_array[server->index_current_address], - (server->ipv6) ? " (IPv6)" : "", - (server->ssl) ? " (SSL)" : "", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6)) ? + " (IPv6)" : "", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? + " (SSL)" : "", str_proxy_type, str_proxy_address, weechat_config_integer (proxy_port), @@ -2377,15 +2212,19 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin) IRC_PLUGIN_NAME, server->addresses_array[server->index_current_address], server->ports_array[server->index_current_address], - (server->ipv6) ? " (IPv6)" : "", - (server->ssl) ? " (SSL)" : ""); + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6)) ? + " (IPv6)" : "", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? + " (SSL)" : ""); weechat_log_printf (_("%s%s: connecting to server %s/%d%s%s..."), "", IRC_PLUGIN_NAME, server->addresses_array[server->index_current_address], server->ports_array[server->index_current_address], - (server->ipv6) ? " (IPv6)" : "", - (server->ssl) ? " (SSL)" : ""); + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6)) ? + " (IPv6)" : "", + (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) ? + " (SSL)" : ""); } /* close connection if open */ @@ -2400,7 +2239,9 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin) } else { - server->sock = socket ((server->ipv6) ? AF_INET6 : AF_INET, SOCK_STREAM, 0); + server->sock = socket ((IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6)) ? + AF_INET6 : AF_INET, + SOCK_STREAM, 0); } if (server->sock == -1) { @@ -2438,23 +2279,23 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin) /* init SSL if asked */ server->ssl_connected = 0; #ifdef HAVE_GNUTLS - if (server->ssl) + if (IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL)) server->ssl_connected = 1; #endif server->disable_autojoin = disable_autojoin; - server->hook_connect = weechat_hook_connect (server->proxy, + server->hook_connect = weechat_hook_connect (proxy, server->addresses_array[server->index_current_address], server->ports_array[server->index_current_address], server->sock, - server->ipv6, + IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6), #ifdef HAVE_GNUTLS (server->ssl_connected) ? &server->gnutls_sess : NULL, #else NULL, #endif - server->local_hostname, + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME), irc_server_connect_cb, server); @@ -2497,7 +2338,8 @@ irc_server_auto_connect (int auto_connect) for (ptr_server = irc_servers; ptr_server; ptr_server = ptr_server->next_server) { - if ((auto_connect) && (ptr_server->autoconnect)) + if (auto_connect + && IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_AUTOCONNECT)) { if (!irc_server_connect (ptr_server, 0)) irc_server_reconnect_schedule (ptr_server); @@ -2556,7 +2398,8 @@ irc_server_disconnect (struct t_irc_server *server, int reconnect) server->lag_next_check = time (NULL) + weechat_config_integer (irc_config_network_lag_check); - if ((reconnect) && (server->autoreconnect)) + if (reconnect + && IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTORECONNECT)) irc_server_reconnect_schedule (server); else server->reconnect_start = 0; @@ -2596,6 +2439,7 @@ void irc_server_autojoin_channels (struct t_irc_server *server) { struct t_irc_channel *ptr_channel; + const char *autojoin; /* auto-join after disconnection (only rejoins opened channels) */ if (!server->disable_autojoin && server->reconnect_join && server->channels) @@ -2618,10 +2462,11 @@ irc_server_autojoin_channels (struct t_irc_server *server) else { /* auto-join when connecting to server for first time */ - if (!server->disable_autojoin && server->autojoin && server->autojoin[0]) - irc_command_join_server (server, server->autojoin); + autojoin = IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_AUTOJOIN); + if (!server->disable_autojoin && autojoin && autojoin[0]) + irc_command_join_server (server, autojoin); } - + server->disable_autojoin = 0; } @@ -3035,39 +2880,56 @@ irc_server_add_to_infolist (struct t_infolist *infolist, && (irc_current_server != server)) ? 0 : 1)) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "autoconnect", server->autoconnect)) + if (!weechat_infolist_new_var_integer (ptr_item, "autoconnect", + IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTOCONNECT))) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "autoreconnect", server->autoreconnect)) + if (!weechat_infolist_new_var_integer (ptr_item, "autoreconnect", + IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTORECONNECT))) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "autoreconnect_delay", server->autoreconnect_delay)) + if (!weechat_infolist_new_var_integer (ptr_item, "autoreconnect_delay", + IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTORECONNECT_DELAY))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "proxy", server->proxy)) + if (!weechat_infolist_new_var_string (ptr_item, "proxy", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "addresses", server->addresses)) + if (!weechat_infolist_new_var_string (ptr_item, "addresses", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_ADDRESSES))) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "ipv6", server->ipv6)) + if (!weechat_infolist_new_var_integer (ptr_item, "ipv6", + IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6))) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "ssl", server->ssl)) + if (!weechat_infolist_new_var_integer (ptr_item, "ssl", + IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "password", server->password)) + if (!weechat_infolist_new_var_string (ptr_item, "password", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PASSWORD))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "nicks", server->nicks)) + if (!weechat_infolist_new_var_string (ptr_item, "nicks", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_NICKS))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "username", server->username)) + if (!weechat_infolist_new_var_string (ptr_item, "username", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "realname", server->realname)) + if (!weechat_infolist_new_var_string (ptr_item, "realname", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_REALNAME))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "local_hostname", server->local_hostname)) + if (!weechat_infolist_new_var_string (ptr_item, "local_hostname", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "command", server->command)) + if (!weechat_infolist_new_var_string (ptr_item, "command", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_COMMAND))) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "command_delay", server->command_delay)) + if (!weechat_infolist_new_var_integer (ptr_item, "command_delay", + IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY))) return 0; - if (!weechat_infolist_new_var_string (ptr_item, "autojoin", server->autojoin)) + if (!weechat_infolist_new_var_string (ptr_item, "autojoin", + IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_AUTOJOIN))) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "autorejoin", server->autorejoin)) + if (!weechat_infolist_new_var_integer (ptr_item, "autorejoin", + IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTOREJOIN))) + return 0; + if (!weechat_infolist_new_var_integer (ptr_item, "temp_server", server->temp_server)) return 0; - if (!weechat_infolist_new_var_integer (ptr_item, "index_current_address", server->index_current_address)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, "sock", server->sock)) @@ -3126,61 +2988,147 @@ irc_server_print_log () ptr_server = ptr_server->next_server) { weechat_log_printf (""); - weechat_log_printf ("[server %s (addr:0x%lx)]", ptr_server->name, ptr_server); - weechat_log_printf (" autoconnect . . . . : %d", ptr_server->autoconnect); - weechat_log_printf (" autoreconnect . . . : %d", ptr_server->autoreconnect); - weechat_log_printf (" autoreconnect_delay : %d", ptr_server->autoreconnect_delay); - weechat_log_printf (" proxy . . . . . . . : '%s'", ptr_server->proxy); - weechat_log_printf (" addresses . . . . . : '%s'", ptr_server->addresses); - weechat_log_printf (" ipv6. . . . . . . . : %d", ptr_server->ipv6); - weechat_log_printf (" ssl . . . . . . . . : %d", ptr_server->ssl); - weechat_log_printf (" password. . . . . . : '%s'", - (ptr_server->password && ptr_server->password[0]) ? - "(hidden)" : ptr_server->password); - weechat_log_printf (" nicks . . . . . . . : '%s'", ptr_server->nicks); - weechat_log_printf (" username. . . . . . : '%s'", ptr_server->username); - weechat_log_printf (" realname. . . . . . : '%s'", ptr_server->realname); - weechat_log_printf (" command . . . . . . : '%s'", - (ptr_server->command && ptr_server->command[0]) ? - "(hidden)" : ptr_server->command); - weechat_log_printf (" command_delay . . . : %d", ptr_server->command_delay); - weechat_log_printf (" autojoin. . . . . . : '%s'", ptr_server->autojoin); - weechat_log_printf (" autorejoin. . . . . : %d", ptr_server->autorejoin); - weechat_log_printf (" reloaded_from_config: %d", ptr_server->reloaded_from_config); - weechat_log_printf (" addresses_count . . : %d", ptr_server->addresses_count); - weechat_log_printf (" addresses_array . . : 0x%lx", ptr_server->addresses_array); - weechat_log_printf (" ports_array . . . . : 0x%lx", ptr_server->ports_array); - weechat_log_printf (" sock. . . . . . . . : %d", ptr_server->sock); - weechat_log_printf (" hook_connect. . . . : 0x%lx", ptr_server->hook_connect); - weechat_log_printf (" hook_fd . . . . . . : 0x%lx", ptr_server->hook_fd); - weechat_log_printf (" is_connected. . . . : %d", ptr_server->is_connected); - weechat_log_printf (" ssl_connected . . . : %d", ptr_server->ssl_connected); - weechat_log_printf (" unterminated_message: '%s'", ptr_server->unterminated_message); - weechat_log_printf (" nicks_count . . . . : %d", ptr_server->nicks_count); - weechat_log_printf (" nicks_array . . . . : 0x%lx", ptr_server->nicks_array); - weechat_log_printf (" nick. . . . . . . . : '%s'", ptr_server->nick); - weechat_log_printf (" nick_modes. . . . . : '%s'", ptr_server->nick_modes); - weechat_log_printf (" prefix. . . . . . . : '%s'", ptr_server->prefix); - weechat_log_printf (" reconnect_start . . : %ld", ptr_server->reconnect_start); - weechat_log_printf (" command_time. . . . : %ld", ptr_server->command_time); - weechat_log_printf (" reconnect_join. . . : %d", ptr_server->reconnect_join); - weechat_log_printf (" disable_autojoin. . : %d", ptr_server->disable_autojoin); - weechat_log_printf (" is_away . . . . . . : %d", ptr_server->is_away); - weechat_log_printf (" away_message. . . . : '%s'", ptr_server->away_message); - weechat_log_printf (" away_time . . . . . : %ld", ptr_server->away_time); - weechat_log_printf (" lag . . . . . . . . : %d", ptr_server->lag); - weechat_log_printf (" lag_check_time. . . : tv_sec:%d, tv_usec:%d", + weechat_log_printf ("[server %s (addr:0x%lx)]", ptr_server->name, ptr_server); + + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_ADDRESSES])) + weechat_log_printf (" addresses. . . . . . : null (%s)", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_ADDRESSES)); + else + weechat_log_printf (" addresses. . . . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_ADDRESSES])); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_PROXY])) + weechat_log_printf (" proxy. . . . . . . . : null (%s)", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_PROXY)); + else + weechat_log_printf (" proxy. . . . . . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_PROXY])); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_IPV6])) + weechat_log_printf (" ipv6 . . . . . . . . : null (%s)", + (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_IPV6)) ? + "on" : "off"); + else + weechat_log_printf (" ipv6 . . . . . . . . : %s", + weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_IPV6]) ? + "on" : "off"); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_SSL])) + weechat_log_printf (" ssl. . . . . . . . . : null (%s)", + (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_SSL)) ? + "on" : "off"); + else + weechat_log_printf (" ssl. . . . . . . . . : %s", + weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_SSL]) ? + "on" : "off"); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_PASSWORD])) + weechat_log_printf (" password . . . . . . : null"); + else + weechat_log_printf (" password . . . . . . : (hidden)"); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_AUTOCONNECT])) + weechat_log_printf (" autoconnect. . . . . : null (%s)", + (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_AUTOCONNECT)) ? + "on" : "off"); + else + weechat_log_printf (" autoconnect. . . . . : %s", + weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_AUTOCONNECT]) ? + "on" : "off"); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_AUTORECONNECT])) + weechat_log_printf (" autoreconnect. . . . : null (%s)", + (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_AUTORECONNECT)) ? + "on" : "off"); + else + weechat_log_printf (" autoreconnect. . . . : %s", + weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_AUTORECONNECT]) ? + "on" : "off"); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_AUTORECONNECT_DELAY])) + weechat_log_printf (" autoreconnect_delay. : null (%d)", + IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_AUTORECONNECT_DELAY)); + else + weechat_log_printf (" autoreconnect_delay. : %d", + weechat_config_integer (ptr_server->options[IRC_SERVER_OPTION_AUTORECONNECT_DELAY])); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_NICKS])) + weechat_log_printf (" nicks. . . . . . . . : null (%s)", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_NICKS)); + else + weechat_log_printf (" nicks. . . . . . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_NICKS])); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_USERNAME])) + weechat_log_printf (" username . . . . . . : null (%s)", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_USERNAME)); + else + weechat_log_printf (" username . . . . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_USERNAME])); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_REALNAME])) + weechat_log_printf (" realname . . . . . . : null (%s)", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_REALNAME)); + else + weechat_log_printf (" realname . . . . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_REALNAME])); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_LOCAL_HOSTNAME])) + weechat_log_printf (" local_hostname . . . : null (%s)", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_LOCAL_HOSTNAME)); + else + weechat_log_printf (" local_hostname . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_LOCAL_HOSTNAME])); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_COMMAND])) + weechat_log_printf (" command. . . . . . . : null"); + else + weechat_log_printf (" command. . . . . . . : (hidden)"); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_COMMAND_DELAY])) + weechat_log_printf (" command_delay. . . . : null (%d)", + IRC_SERVER_OPTION_INTEGER(ptr_server, IRC_SERVER_OPTION_COMMAND_DELAY)); + else + weechat_log_printf (" command_delay. . . . : %d", + weechat_config_integer (ptr_server->options[IRC_SERVER_OPTION_COMMAND_DELAY])); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_AUTOJOIN])) + weechat_log_printf (" autojoin . . . . . . : null (%s)", + IRC_SERVER_OPTION_STRING(ptr_server, IRC_SERVER_OPTION_AUTOJOIN)); + else + weechat_log_printf (" autojoin . . . . . . : '%s'", + weechat_config_string (ptr_server->options[IRC_SERVER_OPTION_AUTOJOIN])); + if (weechat_config_option_is_null (ptr_server->options[IRC_SERVER_OPTION_AUTOREJOIN])) + weechat_log_printf (" autorejoin . . . . . : null (%s)", + (IRC_SERVER_OPTION_BOOLEAN(ptr_server, IRC_SERVER_OPTION_AUTOREJOIN)) ? + "on" : "off"); + else + weechat_log_printf (" autorejoin . . . . . : %s", + weechat_config_boolean (ptr_server->options[IRC_SERVER_OPTION_AUTOREJOIN]) ? + "on" : "off"); + weechat_log_printf (" temp_server. . . . . : %d", ptr_server->temp_server); + weechat_log_printf (" reloading_from_config: %d", ptr_server->reloaded_from_config); + weechat_log_printf (" reloaded_from_config : %d", ptr_server->reloaded_from_config); + weechat_log_printf (" addresses_count. . . : %d", ptr_server->addresses_count); + weechat_log_printf (" addresses_array. . . : 0x%lx", ptr_server->addresses_array); + weechat_log_printf (" ports_array. . . . . : 0x%lx", ptr_server->ports_array); + weechat_log_printf (" sock . . . . . . . . : %d", ptr_server->sock); + weechat_log_printf (" hook_connect . . . . : 0x%lx", ptr_server->hook_connect); + weechat_log_printf (" hook_fd. . . . . . . : 0x%lx", ptr_server->hook_fd); + weechat_log_printf (" is_connected . . . . : %d", ptr_server->is_connected); + weechat_log_printf (" ssl_connected. . . . : %d", ptr_server->ssl_connected); + weechat_log_printf (" unterminated_message : '%s'", ptr_server->unterminated_message); + weechat_log_printf (" nicks_count. . . . . : %d", ptr_server->nicks_count); + weechat_log_printf (" nicks_array. . . . . : 0x%lx", ptr_server->nicks_array); + weechat_log_printf (" nick . . . . . . . . : '%s'", ptr_server->nick); + weechat_log_printf (" nick_modes . . . . . : '%s'", ptr_server->nick_modes); + weechat_log_printf (" prefix . . . . . . . : '%s'", ptr_server->prefix); + weechat_log_printf (" reconnect_start. . . : %ld", ptr_server->reconnect_start); + weechat_log_printf (" command_time . . . . : %ld", ptr_server->command_time); + weechat_log_printf (" reconnect_join . . . : %d", ptr_server->reconnect_join); + weechat_log_printf (" disable_autojoin . . : %d", ptr_server->disable_autojoin); + weechat_log_printf (" is_away. . . . . . . : %d", ptr_server->is_away); + weechat_log_printf (" away_message . . . . : '%s'", ptr_server->away_message); + weechat_log_printf (" away_time. . . . . . : %ld", ptr_server->away_time); + weechat_log_printf (" lag. . . . . . . . . : %d", ptr_server->lag); + weechat_log_printf (" lag_check_time . . . : tv_sec:%d, tv_usec:%d", ptr_server->lag_check_time.tv_sec, ptr_server->lag_check_time.tv_usec); - weechat_log_printf (" lag_next_check. . . : %ld", ptr_server->lag_next_check); - weechat_log_printf (" last_user_message . : %ld", ptr_server->last_user_message); - weechat_log_printf (" outqueue. . . . . . : 0x%lx", ptr_server->outqueue); - weechat_log_printf (" last_outqueue . . . : 0x%lx", ptr_server->last_outqueue); - weechat_log_printf (" buffer. . . . . . . : 0x%lx", ptr_server->buffer); - weechat_log_printf (" channels. . . . . . : 0x%lx", ptr_server->channels); - weechat_log_printf (" last_channel. . . . : 0x%lx", ptr_server->last_channel); - weechat_log_printf (" prev_server . . . . : 0x%lx", ptr_server->prev_server); - weechat_log_printf (" next_server . . . . : 0x%lx", ptr_server->next_server); + weechat_log_printf (" lag_next_check . . . : %ld", ptr_server->lag_next_check); + weechat_log_printf (" last_user_message. . : %ld", ptr_server->last_user_message); + weechat_log_printf (" outqueue . . . . . . : 0x%lx", ptr_server->outqueue); + weechat_log_printf (" last_outqueue. . . . : 0x%lx", ptr_server->last_outqueue); + weechat_log_printf (" buffer . . . . . . . : 0x%lx", ptr_server->buffer); + weechat_log_printf (" channels . . . . . . : 0x%lx", ptr_server->channels); + weechat_log_printf (" last_channel . . . . : 0x%lx", ptr_server->last_channel); + weechat_log_printf (" prev_server. . . . . : 0x%lx", ptr_server->prev_server); + weechat_log_printf (" next_server. . . . . : 0x%lx", ptr_server->next_server); for (ptr_channel = ptr_server->channels; ptr_channel; ptr_channel = ptr_channel->next_channel) diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h index 190ec3148..fbca12a44 100644 --- a/src/plugins/irc/irc-server.h +++ b/src/plugins/irc/irc-server.h @@ -31,6 +31,49 @@ #define NI_MAXHOST 256 #endif +enum t_irc_server_option +{ + IRC_SERVER_OPTION_ADDRESSES = 0, + IRC_SERVER_OPTION_PROXY, + IRC_SERVER_OPTION_IPV6, + IRC_SERVER_OPTION_SSL, + IRC_SERVER_OPTION_PASSWORD, + IRC_SERVER_OPTION_AUTOCONNECT, + IRC_SERVER_OPTION_AUTORECONNECT, + IRC_SERVER_OPTION_AUTORECONNECT_DELAY, + IRC_SERVER_OPTION_NICKS, + IRC_SERVER_OPTION_USERNAME, + IRC_SERVER_OPTION_REALNAME, + IRC_SERVER_OPTION_LOCAL_HOSTNAME, + IRC_SERVER_OPTION_COMMAND, + IRC_SERVER_OPTION_COMMAND_DELAY, + IRC_SERVER_OPTION_AUTOJOIN, + IRC_SERVER_OPTION_AUTOREJOIN, + /* number of server options */ + IRC_SERVER_NUM_OPTIONS, +}; + +#define IRC_SERVER_OPTION_BOOLEAN(__server, __index) \ + ((!weechat_config_option_is_null (__server->options[__index])) ? \ + weechat_config_boolean(__server->options[__index]) : \ + ((!weechat_config_option_is_null (irc_config_server_default[__index])) ? \ + weechat_config_boolean(irc_config_server_default[__index]) \ + : weechat_config_boolean_default(irc_config_server_default[__index]))) + +#define IRC_SERVER_OPTION_INTEGER(__server, __index) \ + ((!weechat_config_option_is_null (__server->options[__index])) ? \ + weechat_config_integer(__server->options[__index]) : \ + ((!weechat_config_option_is_null (irc_config_server_default[__index])) ? \ + weechat_config_integer(irc_config_server_default[__index]) \ + : weechat_config_integer_default(irc_config_server_default[__index]))) + +#define IRC_SERVER_OPTION_STRING(__server, __index) \ + ((!weechat_config_option_is_null (__server->options[__index])) ? \ + weechat_config_string(__server->options[__index]) : \ + ((!weechat_config_option_is_null (irc_config_server_default[__index])) ? \ + weechat_config_string(irc_config_server_default[__index]) \ + : weechat_config_string_default(irc_config_server_default[__index]))) + #define IRC_SERVER_DEFAULT_PORT 6667 #define IRC_SERVER_DEFAULT_PREFIXES_LIST "@%+~&!-" #define IRC_SERVER_DEFAULT_NICKS "weechat1,weechat2,weechat3," \ @@ -59,25 +102,12 @@ struct t_irc_outqueue struct t_irc_server { /* user choices */ - char *name; /* internal name of server */ - int autoconnect; /* = 1 if auto connect at startup */ - int autoreconnect; /* = 1 if auto reco when disconnected */ - int autoreconnect_delay; /* delay before trying again reconnect */ - char *proxy; /* proxy used for this server (optional) */ - char *addresses; /* server addresses (IP/name with port) */ - int ipv6; /* use IPv6 protocol */ - int ssl; /* SSL protocol */ - char *password; /* password for server */ - char *nicks; /* nicknames as one string */ - char *username; /* user name */ - char *realname; /* real name */ - char *local_hostname; /* custom local hostname */ - char *command; /* command to run once connected */ - int command_delay; /* delay after execution of command */ - char *autojoin; /* channels to automatically join */ - int autorejoin; /* auto rejoin channels when kicked */ + char *name; /* internal name of server */ + struct t_config_option *options[IRC_SERVER_NUM_OPTIONS]; /* internal vars */ + int temp_server; /* temporary server (not saved) */ + int reloading_from_config; /* 1 if reloading from config file */ int reloaded_from_config; /* 1 if reloaded from config file */ int addresses_count; /* number of addresses */ char **addresses_array; /* exploded addresses */ @@ -138,21 +168,16 @@ extern const int gnutls_cert_type_prio[]; extern const int gnutls_prot_prio[]; #endif extern struct t_irc_message *irc_recv_msgq, *irc_msgq_last_msg; - +extern char *irc_server_option_string[]; +extern char *irc_server_option_default[]; extern int irc_server_valid (struct t_irc_server *server); +extern int irc_server_search_option (const char *option_name); extern char *irc_server_get_name_without_port (const char *name); -extern void irc_server_new_option (struct t_irc_server *server, - int index_option, - const char *value); extern void irc_server_set_addresses (struct t_irc_server *server, const char *addresses); extern void irc_server_set_nicks (struct t_irc_server *server, const char *nicks); -extern void irc_server_set_with_option (struct t_irc_server *server, - int index_option, - struct t_config_option *option); extern void irc_server_set_nick (struct t_irc_server *server, const char *nick); -extern void irc_server_init (struct t_irc_server *server); extern struct t_irc_server *irc_server_alloc (const char *name); extern int irc_server_alloc_with_url (const char *irc_url); extern void irc_server_free_all (); @@ -172,8 +197,8 @@ extern struct t_irc_server *irc_server_new (const char *name, int autoconnect, int command_delay, const char *autojoin, int autorejoin); -extern struct t_irc_server *irc_server_duplicate (struct t_irc_server *server, - const char *new_name); +extern struct t_irc_server *irc_server_copy (struct t_irc_server *server, + const char *new_name); extern int irc_server_rename (struct t_irc_server *server, const char *new_name); extern void irc_server_send_signal (struct t_irc_server *server, const char *signal, const char *command, diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c index ec28e9774..cd56cafc9 100644 --- a/src/plugins/irc/irc-upgrade.c +++ b/src/plugins/irc/irc-upgrade.c @@ -184,6 +184,8 @@ irc_upgrade_read_cb (int object_id, irc_upgrade_current_server = irc_server_search (weechat_infolist_string (infolist, "name")); if (irc_upgrade_current_server) { + irc_upgrade_current_server->temp_server = + weechat_infolist_integer (infolist, "temp_server"); irc_upgrade_current_server->buffer = NULL; buffer_name = weechat_infolist_string (infolist, "buffer_name"); if (buffer_name && buffer_name[0]) diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c index 9c7a85c39..0d0438e79 100644 --- a/src/plugins/irc/irc.c +++ b/src/plugins/irc/irc.c @@ -193,12 +193,16 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) if (irc_hook_timer_check_away) weechat_unhook (irc_hook_timer_check_away); - irc_config_write (); - if (irc_signal_upgrade_received) + { + irc_config_write (1); irc_upgrade_save (); + } else + { + irc_config_write (0); irc_server_disconnect_all (); + } irc_server_free_all (); diff --git a/src/plugins/logger/logger-config.c b/src/plugins/logger/logger-config.c index 3183be4a5..b24bf746f 100644 --- a/src/plugins/logger/logger-config.c +++ b/src/plugins/logger/logger-config.c @@ -148,7 +148,7 @@ logger_config_level_create_option (void *data, option_name, "integer", _("logging level for this buffer (0 = logging disabled, " "1 = a few messages (most important) .. 9 = all messages)"), - NULL, 0, 9, "9", value, NULL, NULL, + NULL, 0, 9, "9", value, 0, NULL, NULL, &logger_config_level_change, NULL, NULL, NULL); rc = (ptr_option) ? @@ -275,7 +275,7 @@ logger_config_mask_create_option (void *data, option_name, "string", _("file mask for log file; local buffer variables are " "permitted"), - NULL, 0, 0, "", value, NULL, NULL, + NULL, 0, 0, "", value, 0, NULL, NULL, &logger_config_mask_change, NULL, NULL, NULL); rc = (ptr_option) ? @@ -339,7 +339,7 @@ logger_config_init () "backlog", "integer", N_("maximum number of lines to display from log file when creating " "new buffer (0 = no backlog)"), - NULL, 0, INT_MAX, "20", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, INT_MAX, "20", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* file */ ptr_section = weechat_config_new_section (logger_config_file, "file", @@ -358,19 +358,19 @@ logger_config_init () "auto_log", "boolean", N_("automatically save content of buffers to files (unless a buffer " "disables log)"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); logger_config_file_name_lower_case = weechat_config_new_option ( logger_config_file, ptr_section, "name_lower_case", "boolean", N_("use only lower case for log filenames"), - NULL, 0, 0, "on", NULL, NULL, NULL, + NULL, 0, 0, "on", NULL, 0, NULL, NULL, &logger_config_change_file_option_restart_log, NULL, NULL, NULL); logger_config_file_path = weechat_config_new_option ( logger_config_file, ptr_section, "path", "string", N_("path for WeeChat log files ('%h' will be replaced by WeeChat " "home, ~/.weechat by default)"), - NULL, 0, 0, "%h/logs/", NULL, NULL, NULL, + NULL, 0, 0, "%h/logs/", NULL, 0, NULL, NULL, &logger_config_change_file_option_restart_log, NULL, NULL, NULL); logger_config_file_mask = weechat_config_new_option ( logger_config_file, ptr_section, @@ -378,20 +378,20 @@ logger_config_init () N_("default file name mask for log files (format is 'directory/to/file' " "or 'file', without first '/' because 'path' option is used to " "build complete path to file); local buffer variables are permitted"), - NULL, 0, 0, "$plugin.$name.weechatlog", NULL, NULL, NULL, + NULL, 0, 0, "$plugin.$name.weechatlog", NULL, 0, NULL, NULL, &logger_config_change_file_option_restart_log, NULL, NULL, NULL); logger_config_file_info_lines = weechat_config_new_option ( logger_config_file, ptr_section, "info_lines", "boolean", N_("write information line in log file when log starts or ends for a " "buffer"), - NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); logger_config_file_time_format = weechat_config_new_option ( logger_config_file, ptr_section, "time_format", "string", N_("timestamp used in log files (see man strftime for date/time " "specifiers)"), - NULL, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); /* level */ ptr_section = weechat_config_new_section (logger_config_file, "level", diff --git a/src/plugins/logger/logger.c b/src/plugins/logger/logger.c index e8130e8b6..b8783758e 100644 --- a/src/plugins/logger/logger.c +++ b/src/plugins/logger/logger.c @@ -987,11 +987,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) " disable logging for current buffer:\n" " /logger disable\n\n" " set level to 3 for all IRC buffers:\n" - " /set logger.level.irc = 3\n" + " /set logger.level.irc 3\n" " disable logging for main WeeChat buffer:\n" - " /set logger.level.core.weechat = 0\n" + " /set logger.level.core.weechat 0\n" " use a directory per IRC server and a file per channel inside:\n" - " /set logger.mask.irc = $server/$channel.weechatlog\n\n" + " /set logger.mask.irc \"$server/$channel.weechatlog\"\n\n" "Log levels used by IRC plugin:\n" " 1: user message, notice, private\n" " 2: nick change\n" diff --git a/src/plugins/notify/notify.c b/src/plugins/notify/notify.c index 603e2bd7f..9334916b0 100644 --- a/src/plugins/notify/notify.c +++ b/src/plugins/notify/notify.c @@ -263,7 +263,7 @@ notify_config_create_option (void *data, struct t_config_file *config_file, config_file, section, option_name, "integer", NULL, "none|highlight|message|all", - 0, 0, "", value, NULL, NULL, NULL, NULL, NULL, NULL); + 0, 0, "", value, 0, NULL, NULL, NULL, NULL, NULL, NULL); rc = (ptr_option) ? WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR; } diff --git a/src/plugins/plugin-config.c b/src/plugins/plugin-config.c index bc0aa97ea..05a07f67a 100644 --- a/src/plugins/plugin-config.c +++ b/src/plugins/plugin-config.c @@ -96,7 +96,7 @@ plugin_config_set_internal (const char *option, const char *value) ptr_option = config_file_new_option ( plugin_config_file, plugin_config_section_var, option, "string", NULL, - NULL, 0, 0, "", value, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "", value, 0, NULL, NULL, NULL, NULL, NULL, NULL); rc = (ptr_option) ? WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR; } @@ -164,7 +164,7 @@ plugin_config_create_option (void *data, struct t_config_file *config_file, ptr_option = config_file_new_option ( config_file, section, option_name, "string", NULL, - NULL, 0, 0, "", value, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "", value, 0, NULL, NULL, NULL, NULL, NULL, NULL); return (ptr_option) ? WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE : WEECHAT_CONFIG_OPTION_SET_ERROR; diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 4b1c9fe7b..e3c4eba97 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -397,13 +397,20 @@ plugin_load (const char *filename) new_plugin->config_string_to_boolean = &config_file_string_to_boolean; new_plugin->config_option_reset = &config_file_option_reset; new_plugin->config_option_set = &config_file_option_set; + new_plugin->config_option_set_null = &config_file_option_set_null; new_plugin->config_option_unset = &config_file_option_unset; new_plugin->config_option_rename = &config_file_option_rename; new_plugin->config_option_get_pointer = &config_file_option_get_pointer; + new_plugin->config_option_is_null = &config_file_option_is_null; new_plugin->config_boolean = &config_file_option_boolean; + new_plugin->config_boolean_default = &config_file_option_boolean_default; new_plugin->config_integer = &config_file_option_integer; + new_plugin->config_integer_default = &config_file_option_integer_default; new_plugin->config_string = &config_file_option_string; + new_plugin->config_string_default = &config_file_option_string_default; new_plugin->config_color = &config_file_option_color; + new_plugin->config_color_default = &config_file_option_color_default; + new_plugin->config_write_option = &config_file_write_option; new_plugin->config_write_line = &config_file_write_line; new_plugin->config_write = &config_file_write; new_plugin->config_read = &config_file_read; diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c index a8cd965a6..2889cbcbc 100644 --- a/src/plugins/relay/relay-config.c +++ b/src/plugins/relay/relay-config.c @@ -106,7 +106,7 @@ relay_config_init () relay_config_file, ptr_section, "auto_open_buffer", "boolean", N_("auto open relay buffer when a new client is connecting"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); ptr_section = weechat_config_new_section (relay_config_file, "color", 0, 0, @@ -123,49 +123,49 @@ relay_config_init () relay_config_file, ptr_section, "text", "color", N_("text color"), - NULL, 0, 0, "default", NULL, + NULL, 0, 0, "default", NULL, 0, NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); relay_config_color_text_bg = weechat_config_new_option ( relay_config_file, ptr_section, "text_bg", "color", N_("background color"), - NULL, 0, 0, "default", NULL, + NULL, 0, 0, "default", NULL, 0, NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); relay_config_color_text_selected = weechat_config_new_option ( relay_config_file, ptr_section, "text_selected", "color", N_("text color of selected client line"), - NULL, 0, 0, "white", NULL, + NULL, 0, 0, "white", NULL, 0, NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); relay_config_color_status[RELAY_STATUS_CONNECTING] = weechat_config_new_option ( relay_config_file, ptr_section, "status_connecting", "color", N_("text color for \"connecting\" status"), - NULL, 0, 0, "yellow", NULL, + NULL, 0, 0, "yellow", NULL, 0, NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); relay_config_color_status[RELAY_STATUS_WAITING_AUTH] = weechat_config_new_option ( relay_config_file, ptr_section, "status_waiting_auth", "color", N_("text color for \"waiting authentication\" status"), - NULL, 0, 0, "brown", NULL, + NULL, 0, 0, "brown", NULL, 0, NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); relay_config_color_status[RELAY_STATUS_CONNECTED] = weechat_config_new_option ( relay_config_file, ptr_section, "status_active", "color", N_("text color for \"connected\" status"), - NULL, 0, 0, "lightblue", NULL, + NULL, 0, 0, "lightblue", NULL, 0, NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); relay_config_color_status[RELAY_STATUS_AUTH_FAILED] = weechat_config_new_option ( relay_config_file, ptr_section, "status_auth_failed", "color", N_("text color for \"authentication failed\" status"), - NULL, 0, 0, "lightred", NULL, + NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); relay_config_color_status[RELAY_STATUS_DISCONNECTED] = weechat_config_new_option ( relay_config_file, ptr_section, "status_disconnected", "color", N_("text color for \"disconnected\" status"), - NULL, 0, 0, "lightred", NULL, + NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, &relay_config_refresh_cb, NULL, NULL, NULL); ptr_section = weechat_config_new_section (relay_config_file, "network", @@ -185,7 +185,7 @@ relay_config_init () N_("port number (or range of ports) that relay plugin listens on " "(syntax: a single port, ie. 5000 or a port " "range, ie. 5000-5015)"), - NULL, 0, 0, "22373-22400", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "22373-22400", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); return 1; } diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 95d0eaefa..671db30dd 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -1461,7 +1461,7 @@ weechat_lua_api_config_new_option (lua_State *L) const char *string_values, *default_value, *value; const char *function_check_value, *function_change, *function_delete; char *result; - int n, min, max; + int n, min, max, null_value_allowed; /* make C compiler happy */ (void) L; @@ -1482,28 +1482,30 @@ weechat_lua_api_config_new_option (lua_State *L) max = 0; default_value = NULL; value = NULL; + null_value_allowed = 0; function_check_value = NULL; function_change = NULL; function_delete = NULL; n = lua_gettop (lua_current_interpreter); - if (n < 13) + if (n < 14) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option"); LUA_RETURN_EMPTY; } - config_file = lua_tostring (lua_current_interpreter, -13); - section = lua_tostring (lua_current_interpreter, -12); - name = lua_tostring (lua_current_interpreter, -11); - type = lua_tostring (lua_current_interpreter, -10); - description = lua_tostring (lua_current_interpreter, -9); - string_values = lua_tostring (lua_current_interpreter, -8); - min = lua_tonumber (lua_current_interpreter, -7); - max = lua_tonumber (lua_current_interpreter, -6); - default_value = lua_tostring (lua_current_interpreter, -5); - value = lua_tostring (lua_current_interpreter, -4); + config_file = lua_tostring (lua_current_interpreter, -14); + section = lua_tostring (lua_current_interpreter, -13); + name = lua_tostring (lua_current_interpreter, -12); + type = lua_tostring (lua_current_interpreter, -11); + description = lua_tostring (lua_current_interpreter, -10); + string_values = lua_tostring (lua_current_interpreter, -9); + min = lua_tonumber (lua_current_interpreter, -8); + max = lua_tonumber (lua_current_interpreter, -7); + default_value = lua_tostring (lua_current_interpreter, -6); + value = lua_tostring (lua_current_interpreter, -5); + null_value_allowed = lua_tonumber (lua_current_interpreter, -4); function_check_value = lua_tostring (lua_current_interpreter, -3); function_change = lua_tostring (lua_current_interpreter, -2); function_delete = lua_tostring (lua_current_interpreter, -1); @@ -1520,6 +1522,7 @@ weechat_lua_api_config_new_option (lua_State *L) max, default_value, value, + null_value_allowed, &weechat_lua_api_config_option_check_value_cb, function_check_value, &weechat_lua_api_config_option_change_cb, @@ -1664,7 +1667,7 @@ weechat_lua_api_config_option_set (lua_State *L) if (!lua_current_script) { WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set"); - LUA_RETURN_INT(0); + LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } option = NULL; @@ -1676,7 +1679,7 @@ weechat_lua_api_config_option_set (lua_State *L) if (n < 3) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set"); - LUA_RETURN_INT(0); + LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } option = lua_tostring (lua_current_interpreter, -3); @@ -1691,6 +1694,46 @@ weechat_lua_api_config_option_set (lua_State *L) } /* + * weechat_lua_api_config_option_set_null: set null (undefined) value for + * option + */ + +static int +weechat_lua_api_config_option_set_null (lua_State *L) +{ + const char *option; + int n, run_callback, rc; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set_null"); + LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + } + + option = NULL; + run_callback = 0; + + n = lua_gettop (lua_current_interpreter); + + if (n < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set_null"); + LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + } + + option = lua_tostring (lua_current_interpreter, -2); + run_callback = lua_tonumber (lua_current_interpreter, -1); + + rc = weechat_config_option_set_null (script_str2ptr (option), + run_callback); + + LUA_RETURN_INT(rc); +} + +/* * weechat_lua_api_config_option_unset: unset an option */ @@ -1706,7 +1749,7 @@ weechat_lua_api_config_option_unset (lua_State *L) if (!lua_current_script) { WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset"); - LUA_RETURN_INT(0); + LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); } option = NULL; @@ -1716,7 +1759,7 @@ weechat_lua_api_config_option_unset (lua_State *L) if (n < 1) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset"); - LUA_RETURN_INT(0); + LUA_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); } option = lua_tostring (lua_current_interpreter, -1); @@ -1741,7 +1784,7 @@ weechat_lua_api_config_option_rename (lua_State *L) if (!lua_current_script) { - WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_rename");; + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_rename"); LUA_RETURN_ERROR; } @@ -1766,6 +1809,79 @@ weechat_lua_api_config_option_rename (lua_State *L) } /* + * weechat_lua_api_config_option_is_null: return 1 if value of option is null + */ + +static int +weechat_lua_api_config_option_is_null (lua_State *L) +{ + const char *option; + int n, value; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_is_null"); + LUA_RETURN_INT(1); + } + + option = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_is_null"); + LUA_RETURN_INT(1); + } + + option = lua_tostring (lua_current_interpreter, -1); + + value = weechat_config_option_is_null (script_str2ptr (option)); + + LUA_RETURN_INT(value); +} + +/* + * weechat_lua_api_config_option_default_is_null: return 1 if default value of + * option is null + */ + +static int +weechat_lua_api_config_option_default_is_null (lua_State *L) +{ + const char *option; + int n, value; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_default_is_null"); + LUA_RETURN_INT(1); + } + + option = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_default_is_null"); + LUA_RETURN_INT(1); + } + + option = lua_tostring (lua_current_interpreter, -1); + + value = weechat_config_option_default_is_null (script_str2ptr (option)); + + LUA_RETURN_INT(value); +} + +/* * weechat_lua_api_config_boolean: return boolean value of option */ @@ -1910,6 +2026,45 @@ weechat_lua_api_config_color (lua_State *L) } /* + * weechat_lua_api_config_write_option: write an option in configuration file + */ + +static int +weechat_lua_api_config_write_option (lua_State *L) +{ + const char *config_file, *option; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_write_option"); + LUA_RETURN_ERROR; + } + + config_file = NULL; + option = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_write_option"); + LUA_RETURN_ERROR; + } + + config_file = lua_tostring (lua_current_interpreter, -2); + option = lua_tostring (lua_current_interpreter, -1); + + weechat_config_write_option (script_str2ptr (config_file), + script_str2ptr (option)); + + LUA_RETURN_OK; +} + +/* * weechat_lua_api_config_write_line: write a line in configuration file */ @@ -5880,12 +6035,16 @@ const struct luaL_reg weechat_lua_api_funcs[] = { { "config_string_to_boolean", &weechat_lua_api_config_string_to_boolean }, { "config_option_reset", &weechat_lua_api_config_option_reset }, { "config_option_set", &weechat_lua_api_config_option_set }, + { "config_option_set_null", &weechat_lua_api_config_option_set_null }, { "config_option_unset", &weechat_lua_api_config_option_unset }, { "config_option_rename", &weechat_lua_api_config_option_rename }, + { "config_option_is_null", &weechat_lua_api_config_option_is_null }, + { "config_option_default_is_null", &weechat_lua_api_config_option_default_is_null }, { "config_boolean", &weechat_lua_api_config_boolean }, { "config_integer", &weechat_lua_api_config_integer }, { "config_string", &weechat_lua_api_config_string }, { "config_color", &weechat_lua_api_config_color }, + { "config_write_option", &weechat_lua_api_config_write_option }, { "config_write_line", &weechat_lua_api_config_write_line }, { "config_write", &weechat_lua_api_config_write }, { "config_read", &weechat_lua_api_config_read }, diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index ab463c05d..396673b37 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -1260,7 +1260,7 @@ static XS (XS_weechat_api_config_new_option) PERL_RETURN_EMPTY; } - if (items < 13) + if (items < 14) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option"); PERL_RETURN_EMPTY; @@ -1274,9 +1274,9 @@ static XS (XS_weechat_api_config_new_option) string_values = SvPV (ST (5), PL_na); default_value = SvPV (ST (8), PL_na); value = SvPV (ST (9), PL_na); - function_check_value = SvPV (ST (10), PL_na); - function_change = SvPV (ST (11), PL_na); - function_delete = SvPV (ST (12), PL_na); + function_check_value = SvPV (ST (11), PL_na); + function_change = SvPV (ST (12), PL_na); + function_delete = SvPV (ST (13), PL_na); result = script_ptr2str (script_api_config_new_option (weechat_perl_plugin, perl_current_script, script_str2ptr (config_file), @@ -1289,6 +1289,7 @@ static XS (XS_weechat_api_config_new_option) SvIV (ST (7)), /* max */ default_value, value, + SvIV (ST (10)), /* null_value_allowed */ &weechat_perl_api_config_option_check_value_cb, function_check_value, &weechat_perl_api_config_option_change_cb, @@ -1410,13 +1411,13 @@ static XS (XS_weechat_api_config_option_set) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } if (items < 3) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } option = SvPV (ST (0), PL_na); @@ -1429,6 +1430,38 @@ static XS (XS_weechat_api_config_option_set) } /* + * weechat::config_option_set_null: set null (undefined) value for option + */ + +static XS (XS_weechat_api_config_option_set_null) +{ + int rc; + char *option; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set_null"); + PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + } + + if (items < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set_null"); + PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + } + + option = SvPV (ST (0), PL_na); + rc = weechat_config_option_set_null (script_str2ptr (option), + SvIV (ST (1))); /* run_callback */ + + PERL_RETURN_INT(rc); +} + +/* * weechat::config_option_unset: unset an option */ @@ -1444,13 +1477,13 @@ static XS (XS_weechat_api_config_option_unset) if (!perl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); } if (items < 1) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset"); - PERL_RETURN_INT(0); + PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); } option = SvPV (ST (0), PL_na); @@ -1492,6 +1525,65 @@ static XS (XS_weechat_api_config_option_rename) } /* + * weechat::config_option_is_null: return 1 if value of option is null + */ + +static XS (XS_weechat_api_config_option_is_null) +{ + int value; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_is_null"); + PERL_RETURN_INT(1); + } + + if (items < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_is_null"); + PERL_RETURN_INT(1); + } + + value = weechat_config_option_is_null (script_str2ptr (SvPV (ST (0), PL_na))); /* option */ + + PERL_RETURN_INT(value); +} + +/* + * weechat::config_option_default_is_null: return 1 if default value of option + * is null + */ + +static XS (XS_weechat_api_config_option_default_is_null) +{ + int value; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_default_is_null"); + PERL_RETURN_INT(1); + } + + if (items < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_default_is_null"); + PERL_RETURN_INT(1); + } + + value = weechat_config_option_default_is_null (script_str2ptr (SvPV (ST (0), PL_na))); /* option */ + + PERL_RETURN_INT(value); +} + +/* * weechat::config_boolean: return boolean value of option */ @@ -1608,6 +1700,38 @@ static XS (XS_weechat_api_config_color) } /* + * weechat::config_write_option: write an option in configuration file + */ + +static XS (XS_weechat_api_config_write_option) +{ + char *config_file, *option; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_write_option"); + PERL_RETURN_ERROR; + } + + if (items < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_write_option"); + PERL_RETURN_ERROR; + } + + config_file = SvPV (ST (0), PL_na); + option = SvPV (ST (1), PL_na); + weechat_config_write_option (script_str2ptr (config_file), + script_str2ptr (option)); + + PERL_RETURN_OK; +} + +/* * weechat::config_write_line: write a line in configuration file */ @@ -4624,12 +4748,16 @@ weechat_perl_api_init (pTHX) newXS ("weechat::config_string_to_boolean", XS_weechat_api_config_string_to_boolean, "weechat"); newXS ("weechat::config_option_reset", XS_weechat_api_config_option_reset, "weechat"); newXS ("weechat::config_option_set", XS_weechat_api_config_option_set, "weechat"); + newXS ("weechat::config_option_set_null", XS_weechat_api_config_option_set_null, "weechat"); newXS ("weechat::config_option_unset", XS_weechat_api_config_option_unset, "weechat"); newXS ("weechat::config_option_rename", XS_weechat_api_config_option_rename, "weechat"); + newXS ("weechat::config_option_is_null", XS_weechat_api_config_option_is_null, "weechat"); + newXS ("weechat::config_option_default_is_null", XS_weechat_api_config_option_default_is_null, "weechat"); newXS ("weechat::config_boolean", XS_weechat_api_config_boolean, "weechat"); newXS ("weechat::config_integer", XS_weechat_api_config_integer, "weechat"); newXS ("weechat::config_string", XS_weechat_api_config_string, "weechat"); newXS ("weechat::config_color", XS_weechat_api_config_color, "weechat"); + newXS ("weechat::config_write_option", XS_weechat_api_config_write_option, "weechat"); newXS ("weechat::config_write_line", XS_weechat_api_config_write_line, "weechat"); newXS ("weechat::config_write", XS_weechat_api_config_write, "weechat"); newXS ("weechat::config_read", XS_weechat_api_config_read, "weechat"); diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 06459fb84..d4097b242 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -1316,7 +1316,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args) char *config_file, *section, *name, *type, *description, *string_values; char *default_value, *value, *result; char *function_check_value, *function_change, *function_delete; - int min, max; + int min, max, null_value_allowed; PyObject *object; /* make C compiler happy */ @@ -1340,10 +1340,11 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args) function_change = NULL; function_delete = NULL; - if (!PyArg_ParseTuple (args, "ssssssiisssss", &config_file, §ion, &name, + if (!PyArg_ParseTuple (args, "ssssssiississs", &config_file, §ion, &name, &type, &description, &string_values, &min, &max, - &default_value, &value, &function_check_value, - &function_change, &function_delete)) + &default_value, &value, &null_value_allowed, + &function_check_value, &function_change, + &function_delete)) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option"); PYTHON_RETURN_EMPTY; @@ -1361,6 +1362,7 @@ weechat_python_api_config_new_option (PyObject *self, PyObject *args) max, default_value, value, + null_value_allowed, &weechat_python_api_config_option_check_value_cb, function_check_value, &weechat_python_api_config_option_change_cb, @@ -1489,7 +1491,7 @@ weechat_python_api_config_option_set (PyObject *self, PyObject *args) if (!python_current_script) { WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set"); - PYTHON_RETURN_INT(0); + PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } option = NULL; @@ -1499,7 +1501,7 @@ weechat_python_api_config_option_set (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "ssi", &option, &new_value, &run_callback)) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set"); - PYTHON_RETURN_INT(0); + PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } rc = weechat_config_option_set (script_str2ptr (option), @@ -1510,6 +1512,41 @@ weechat_python_api_config_option_set (PyObject *self, PyObject *args) } /* + * weechat_python_api_config_option_set_null: set null (undefined) value for + * option + */ + +static PyObject * +weechat_python_api_config_option_set_null (PyObject *self, PyObject *args) +{ + char *option; + int run_callback, rc; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set_null"); + PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + } + + option = NULL; + run_callback = 0; + + if (!PyArg_ParseTuple (args, "si", &option, &run_callback)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set_null"); + PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + } + + rc = weechat_config_option_set_null (script_str2ptr (option), + run_callback); + + PYTHON_RETURN_INT(rc); +} + +/* * weechat_python_api_config_option_unset: unset an option */ @@ -1525,7 +1562,7 @@ weechat_python_api_config_option_unset (PyObject *self, PyObject *args) if (!python_current_script) { WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset"); - PYTHON_RETURN_INT(0); + PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); } option = NULL; @@ -1533,7 +1570,7 @@ weechat_python_api_config_option_unset (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "s", &option)) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset"); - PYTHON_RETURN_INT(0); + PYTHON_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); } rc = weechat_config_option_unset (script_str2ptr (option)); @@ -1575,6 +1612,71 @@ weechat_python_api_config_option_rename (PyObject *self, PyObject *args) } /* + * weechat_python_api_config_option_is_null: return 1 if value of option is null + */ + +static PyObject * +weechat_python_api_config_option_is_null (PyObject *self, PyObject *args) +{ + char *option; + int value; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_is_null"); + PYTHON_RETURN_INT(1); + } + + option = NULL; + + if (!PyArg_ParseTuple (args, "s", &option)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_is_null"); + PYTHON_RETURN_INT(1); + } + + value = weechat_config_option_is_null (script_str2ptr (option)); + + PYTHON_RETURN_INT(value); +} + +/* + * weechat_python_api_config_option_default_is_null: return 1 if default value + * of option is null + */ + +static PyObject * +weechat_python_api_config_option_default_is_null (PyObject *self, PyObject *args) +{ + char *option; + int value; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_default_is_null"); + PYTHON_RETURN_INT(1); + } + + option = NULL; + + if (!PyArg_ParseTuple (args, "s", &option)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_default_is_null"); + PYTHON_RETURN_INT(1); + } + + value = weechat_config_option_default_is_null (script_str2ptr (option)); + + PYTHON_RETURN_INT(value); +} + +/* * weechat_python_api_config_boolean: return boolean value of option */ @@ -1703,6 +1805,39 @@ weechat_python_api_config_color (PyObject *self, PyObject *args) } /* + * weechat_python_api_config_write_option: write an option in configuration file + */ + +static PyObject * +weechat_python_api_config_write_option (PyObject *self, PyObject *args) +{ + char *config_file, *option; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_write_option"); + PYTHON_RETURN_ERROR; + } + + config_file = NULL; + option = NULL; + + if (!PyArg_ParseTuple (args, "ss", &config_file, &option)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_write_option"); + PYTHON_RETURN_ERROR; + } + + weechat_config_write_option (script_str2ptr (config_file), + script_str2ptr (option)); + + PYTHON_RETURN_OK; +} + +/* * weechat_python_api_config_write_line: write a line in configuration file */ @@ -4911,12 +5046,16 @@ PyMethodDef weechat_python_funcs[] = { "config_string_to_boolean", &weechat_python_api_config_string_to_boolean, METH_VARARGS, "" }, { "config_option_reset", &weechat_python_api_config_option_reset, METH_VARARGS, "" }, { "config_option_set", &weechat_python_api_config_option_set, METH_VARARGS, "" }, + { "config_option_set_null", &weechat_python_api_config_option_set_null, METH_VARARGS, "" }, { "config_option_unset", &weechat_python_api_config_option_unset, METH_VARARGS, "" }, { "config_option_rename", &weechat_python_api_config_option_rename, METH_VARARGS, "" }, + { "config_option_is_null", &weechat_python_api_config_option_is_null, METH_VARARGS, "" }, + { "config_option_default_is_null", &weechat_python_api_config_option_default_is_null, METH_VARARGS, "" }, { "config_boolean", &weechat_python_api_config_boolean, METH_VARARGS, "" }, { "config_integer", &weechat_python_api_config_integer, METH_VARARGS, "" }, { "config_string", &weechat_python_api_config_string, METH_VARARGS, "" }, { "config_color", &weechat_python_api_config_color, METH_VARARGS, "" }, + { "config_write_option", &weechat_python_api_config_write_option, METH_VARARGS, "" }, { "config_write_line", &weechat_python_api_config_write_line, METH_VARARGS, "" }, { "config_write", &weechat_python_api_config_write, METH_VARARGS, "" }, { "config_read", &weechat_python_api_config_read, METH_VARARGS, "" }, diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 8dc690f7e..28cd43ed4 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -1477,7 +1477,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file, VALUE section, VALUE name, VALUE type, VALUE description, VALUE string_values, VALUE min, VALUE max, VALUE default_value, - VALUE value, + VALUE value, VALUE null_value_allowed, VALUE function_check_value, VALUE function_change, VALUE function_delete) @@ -1485,7 +1485,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file, char *c_config_file, *c_section, *c_name, *c_type, *c_description; char *c_string_values, *c_default_value, *c_value, *result; char *c_function_check_value, *c_function_change, *c_function_delete; - int c_min, c_max; + int c_min, c_max, c_null_value_allowed; VALUE return_value; /* make C compiler happy */ @@ -1507,13 +1507,14 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file, c_max = 0; c_default_value = NULL; c_value = NULL; + c_null_value_allowed = 0; c_function_check_value = NULL; c_function_change = NULL; c_function_delete = NULL; if (NIL_P (config_file) || NIL_P (section) || NIL_P (name) || NIL_P (type) || NIL_P (description) || NIL_P (string_values) - || NIL_P (default_value) || NIL_P (value) + || NIL_P (default_value) || NIL_P (value) || NIL_P (null_value_allowed) || NIL_P (function_check_value) || NIL_P (function_change) || NIL_P (function_delete)) { @@ -1531,6 +1532,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file, Check_Type (max, T_FIXNUM); Check_Type (default_value, T_STRING); Check_Type (value, T_STRING); + Check_Type (null_value_allowed, T_FIXNUM); Check_Type (function_check_value, T_STRING); Check_Type (function_change, T_STRING); Check_Type (function_delete, T_STRING); @@ -1545,6 +1547,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file, c_max = FIX2INT (max); c_default_value = STR2CSTR (default_value); c_value = STR2CSTR (value); + c_null_value_allowed = FIX2INT (null_value_allowed); c_function_check_value = STR2CSTR (function_check_value); c_function_change = STR2CSTR (function_change); c_function_delete = STR2CSTR (function_delete); @@ -1561,6 +1564,7 @@ weechat_ruby_api_config_new_option (VALUE class, VALUE config_file, c_max, c_default_value, c_value, + c_null_value_allowed, &weechat_ruby_api_config_option_check_value_cb, c_function_check_value, &weechat_ruby_api_config_option_change_cb, @@ -1710,7 +1714,7 @@ weechat_ruby_api_config_option_set (VALUE class, VALUE option, VALUE new_value, if (!ruby_current_script) { WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set"); - RUBY_RETURN_INT(0); + RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } c_option = NULL; @@ -1720,7 +1724,7 @@ weechat_ruby_api_config_option_set (VALUE class, VALUE option, VALUE new_value, if (NIL_P (option) || NIL_P (new_value) || NIL_P (run_callback)) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set"); - RUBY_RETURN_INT(0); + RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } Check_Type (option, T_STRING); @@ -1739,6 +1743,48 @@ weechat_ruby_api_config_option_set (VALUE class, VALUE option, VALUE new_value, } /* + * weechat_ruby_api_config_option_set_null: set null (undefined) value for + * option + */ + +static VALUE +weechat_ruby_api_config_option_set_null (VALUE class, VALUE option, + VALUE run_callback) +{ + char *c_option; + int c_run_callback, rc; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set_null"); + RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + } + + c_option = NULL; + c_run_callback = 0; + + if (NIL_P (option) || NIL_P (run_callback)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set_null"); + RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + } + + Check_Type (option, T_STRING); + Check_Type (run_callback, T_FIXNUM); + + c_option = STR2CSTR (option); + c_run_callback = FIX2INT (run_callback); + + rc = weechat_config_option_set_null (script_str2ptr (c_option), + c_run_callback); + + RUBY_RETURN_INT(rc); +} + +/* * weechat_ruby_api_config_option_unset: unset an option */ @@ -1754,7 +1800,7 @@ weechat_ruby_api_config_option_unset (VALUE class, VALUE option) if (!ruby_current_script) { WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset"); - RUBY_RETURN_INT(0); + RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); } c_option = NULL; @@ -1762,7 +1808,7 @@ weechat_ruby_api_config_option_unset (VALUE class, VALUE option) if (NIL_P (option)) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset"); - RUBY_RETURN_INT(0); + RUBY_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); } Check_Type (option, T_STRING); @@ -1815,6 +1861,78 @@ weechat_ruby_api_config_option_rename (VALUE class, VALUE option, } /* + * weechat_ruby_api_config_option_is_null: return 1 if value of option is null + */ + +static VALUE +weechat_ruby_api_config_option_is_null (VALUE class, VALUE option) +{ + char *c_option; + int value; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_is_null"); + RUBY_RETURN_INT(1); + } + + c_option = NULL; + + if (NIL_P (option)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_is_null"); + RUBY_RETURN_INT(1); + } + + Check_Type (option, T_STRING); + + c_option = STR2CSTR (option); + + value = weechat_config_option_is_null (script_str2ptr (c_option)); + + RUBY_RETURN_INT(value); +} + +/* + * weechat_ruby_api_config_option_default_is_null: return 1 if value of option is null + */ + +static VALUE +weechat_ruby_api_config_option_default_is_null (VALUE class, VALUE option) +{ + char *c_option; + int value; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_default_is_null"); + RUBY_RETURN_INT(1); + } + + c_option = NULL; + + if (NIL_P (option)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_default_is_null"); + RUBY_RETURN_INT(1); + } + + Check_Type (option, T_STRING); + + c_option = STR2CSTR (option); + + value = weechat_config_option_default_is_null (script_str2ptr (c_option)); + + RUBY_RETURN_INT(value); +} + +/* * weechat_ruby_api_config_boolean: return boolean value of option */ @@ -1959,6 +2077,46 @@ weechat_ruby_api_config_color (VALUE class, VALUE option) } /* + * weechat_ruby_api_config_write_option: write an option in configuration file + */ + +static VALUE +weechat_ruby_api_config_write_option (VALUE class, VALUE config_file, + VALUE option) +{ + char *c_config_file, *c_option; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_write_option"); + RUBY_RETURN_ERROR; + } + + c_config_file = NULL; + c_option = NULL; + + if (NIL_P (config_file) || NIL_P (option)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_write_option"); + RUBY_RETURN_ERROR; + } + + Check_Type (config_file, T_STRING); + Check_Type (option, T_STRING); + + c_config_file = STR2CSTR (config_file); + c_option = STR2CSTR (option); + + weechat_config_write_option (script_str2ptr (c_config_file), + script_str2ptr (c_option)); + + RUBY_RETURN_OK; +} + +/* * weechat_ruby_api_config_write_line: write a line in configuration file */ @@ -5636,17 +5794,21 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) rb_define_module_function (ruby_mWeechat, "config_new", &weechat_ruby_api_config_new, 2); rb_define_module_function (ruby_mWeechat, "config_new_section", &weechat_ruby_api_config_new_section, 9); rb_define_module_function (ruby_mWeechat, "config_search_section", &weechat_ruby_api_config_search_section, 2); - rb_define_module_function (ruby_mWeechat, "config_new_option", &weechat_ruby_api_config_new_option, 13); + rb_define_module_function (ruby_mWeechat, "config_new_option", &weechat_ruby_api_config_new_option, 14); rb_define_module_function (ruby_mWeechat, "config_search_option", &weechat_ruby_api_config_search_option, 3); rb_define_module_function (ruby_mWeechat, "config_string_to_boolean", &weechat_ruby_api_config_string_to_boolean, 1); rb_define_module_function (ruby_mWeechat, "config_option_reset", &weechat_ruby_api_config_option_reset, 2); rb_define_module_function (ruby_mWeechat, "config_option_set", &weechat_ruby_api_config_option_set, 3); + rb_define_module_function (ruby_mWeechat, "config_option_set_null", &weechat_ruby_api_config_option_set_null, 2); rb_define_module_function (ruby_mWeechat, "config_option_unset", &weechat_ruby_api_config_option_unset, 1); rb_define_module_function (ruby_mWeechat, "config_option_rename", &weechat_ruby_api_config_option_rename, 2); + rb_define_module_function (ruby_mWeechat, "config_option_is_null", &weechat_ruby_api_config_option_is_null, 1); + rb_define_module_function (ruby_mWeechat, "config_option_default_is_null", &weechat_ruby_api_config_option_default_is_null, 1); rb_define_module_function (ruby_mWeechat, "config_boolean", &weechat_ruby_api_config_boolean, 1); rb_define_module_function (ruby_mWeechat, "config_integer", &weechat_ruby_api_config_integer, 1); rb_define_module_function (ruby_mWeechat, "config_string", &weechat_ruby_api_config_string, 1); rb_define_module_function (ruby_mWeechat, "config_color", &weechat_ruby_api_config_color, 1); + rb_define_module_function (ruby_mWeechat, "config_write_option", &weechat_ruby_api_config_write_option, 2); rb_define_module_function (ruby_mWeechat, "config_write_line", &weechat_ruby_api_config_write_line, 3); rb_define_module_function (ruby_mWeechat, "config_write", &weechat_ruby_api_config_write, 1); rb_define_module_function (ruby_mWeechat, "config_read", &weechat_ruby_api_config_read, 1); diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c index 0e07965f7..d810a4a77 100644 --- a/src/plugins/scripts/script-api.c +++ b/src/plugins/scripts/script-api.c @@ -347,6 +347,7 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin, int min, int max, const char *default_value, const char *value, + int null_value_allowed, void (*callback_check_value)(void *data, struct t_config_option *option, const char *value), @@ -416,6 +417,7 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin, new_option = weechat_config_new_option (config_file, section, name, type, description, string_values, min, max, default_value, value, + null_value_allowed, callback1, new_script_callback1, callback2, new_script_callback2, callback3, new_script_callback3); diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h index eff244667..d498b22e4 100644 --- a/src/plugins/scripts/script-api.h +++ b/src/plugins/scripts/script-api.h @@ -68,6 +68,7 @@ extern struct t_config_option *script_api_config_new_option (struct t_weechat_pl int min, int max, const char *default_value, const char *value, + int null_value_allowed, void (*callback_check_value)(void *data, struct t_config_option *option, const char *value), diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index fd6d83496..29a192d1f 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -1458,10 +1458,6 @@ weechat_tcl_api_config_option_delete_cb (void *data, } } - - - - /* * weechat_tcl_api_config_new_option: create a new option in section */ @@ -1474,7 +1470,7 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp, char *result, *config_file, *section, *name, *type; char *description, *string_values, *default_value, *value; char *function_check_value, *function_change, *function_delete; - int i,min,max; + int i, min, max, null_value_allowed; /* make C compiler happy */ (void) clientData; @@ -1485,14 +1481,15 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp, TCL_RETURN_EMPTY; } - if (objc < 14) + if (objc < 15) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option"); TCL_RETURN_EMPTY; } if ((Tcl_GetIntFromObj (interp, objv[7], &min) != TCL_OK) - || (Tcl_GetIntFromObj (interp, objv[8], &max) != TCL_OK)) + || (Tcl_GetIntFromObj (interp, objv[8], &max) != TCL_OK) + || (Tcl_GetIntFromObj (interp, objv[11], &null_value_allowed) != TCL_OK)) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_new_option"); TCL_RETURN_EMPTY; @@ -1506,9 +1503,9 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp, string_values = Tcl_GetStringFromObj (objv[6], &i); default_value = Tcl_GetStringFromObj (objv[9], &i); value = Tcl_GetStringFromObj (objv[10], &i); - function_check_value = Tcl_GetStringFromObj (objv[11], &i); - function_change = Tcl_GetStringFromObj (objv[12], &i); - function_delete = Tcl_GetStringFromObj (objv[13], &i); + function_check_value = Tcl_GetStringFromObj (objv[12], &i); + function_change = Tcl_GetStringFromObj (objv[13], &i); + function_delete = Tcl_GetStringFromObj (objv[14], &i); result = script_ptr2str (script_api_config_new_option (weechat_tcl_plugin, tcl_current_script, @@ -1522,6 +1519,7 @@ weechat_tcl_api_config_new_option (ClientData clientData, Tcl_Interp *interp, max, default_value, value, + null_value_allowed, &weechat_tcl_api_config_option_check_value_cb, function_check_value, &weechat_tcl_api_config_option_change_cb, @@ -1653,7 +1651,7 @@ weechat_tcl_api_config_option_set (ClientData clientData, Tcl_Interp *interp, Tcl_Obj* objp; int rc; char *option, *new_value; - int i,run_cb; + int i, run_callback; /* make C compiler happy */ (void) clientData; @@ -1661,26 +1659,67 @@ weechat_tcl_api_config_option_set (ClientData clientData, Tcl_Interp *interp, if (!tcl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set"); - TCL_RETURN_INT(0); + TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } if (objc < 4) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set"); - TCL_RETURN_INT(0); + TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } - if (Tcl_GetIntFromObj (interp, objv[3], &run_cb) != TCL_OK) + if (Tcl_GetIntFromObj (interp, objv[3], &run_callback) != TCL_OK) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set"); - TCL_RETURN_INT(0); + TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); } option = Tcl_GetStringFromObj (objv[1], &i); new_value = Tcl_GetStringFromObj (objv[2], &i); rc = weechat_config_option_set (script_str2ptr (option), new_value, - run_cb); /* run_callback */ + run_callback); + + TCL_RETURN_INT(rc); +} + +/* + * weechat_tcl_api_config_option_set_null: set null (undefined)value for option + */ + +static int +weechat_tcl_api_config_option_set_null (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj* objp; + int rc; + char *option; + int i, run_callback; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_set_null"); + TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + } + + if (objc < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set_null"); + TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + } + + if (Tcl_GetIntFromObj (interp, objv[2], &run_callback) != TCL_OK) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_set_null"); + TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR); + } + + option = Tcl_GetStringFromObj (objv[1], &i); + rc = weechat_config_option_set_null (script_str2ptr (option), + run_callback); TCL_RETURN_INT(rc); } @@ -1704,13 +1743,13 @@ weechat_tcl_api_config_option_unset (ClientData clientData, Tcl_Interp *interp, if (!tcl_current_script) { WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset"); - TCL_RETURN_INT(0); + TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); } if (objc < 2) { WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset"); - TCL_RETURN_INT(0); + TCL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR); } option = Tcl_GetStringFromObj (objv[1], &i); @@ -1748,6 +1787,7 @@ weechat_tcl_api_config_option_rename (ClientData clientData, Tcl_Interp *interp, option = Tcl_GetStringFromObj (objv[1], &i); new_name = Tcl_GetStringFromObj (objv[2], &i); + weechat_config_option_rename (script_str2ptr (option), new_name); @@ -1755,6 +1795,70 @@ weechat_tcl_api_config_option_rename (ClientData clientData, Tcl_Interp *interp, } /* + * weechat_tcl_api_config_option_is_null: return 1 if value of option is null + */ + +static int +weechat_tcl_api_config_option_is_null (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj* objp; + int result, i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_is_null"); + TCL_RETURN_INT(1); + } + + if (objc < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_is_null"); + TCL_RETURN_INT(1); + } + + result = weechat_config_option_is_null (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + + TCL_RETURN_INT(result); +} + +/* + * weechat_tcl_api_config_option_default_is_null: return 1 if default value of + * option is null + */ + +static int +weechat_tcl_api_config_option_default_is_null (ClientData clientData, + Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj* objp; + int result, i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_default_is_null"); + TCL_RETURN_INT(1); + } + + if (objc < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_default_is_null"); + TCL_RETURN_INT(1); + } + + result = weechat_config_option_default_is_null (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + + TCL_RETURN_INT(result); +} + +/* * weechat_tcl_api_config_boolean: return boolean value of option */ @@ -1881,6 +1985,41 @@ weechat_tcl_api_config_color (ClientData clientData, Tcl_Interp *interp, } /* + * weechat_tcl_api_config_write_option: write an option in configuration file + */ + +static int +weechat_tcl_api_config_write_option (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *config_file, *option; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_write_option"); + TCL_RETURN_ERROR; + } + + if (objc < 3) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_write_option"); + TCL_RETURN_ERROR; + } + + config_file = Tcl_GetStringFromObj (objv[1], &i); + option = Tcl_GetStringFromObj (objv[2], &i); + weechat_config_write_option (script_str2ptr (config_file), + script_str2ptr (option)); + + TCL_RETURN_OK; +} + +/* * weechat_tcl_api_config_write_line: write a line in configuration file */ @@ -5324,10 +5463,16 @@ void weechat_tcl_api_init (Tcl_Interp *interp) { weechat_tcl_api_config_option_reset, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_option_set", weechat_tcl_api_config_option_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp,"weechat::config_option_set_null", + weechat_tcl_api_config_option_set_null, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_option_unset", weechat_tcl_api_config_option_unset, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_option_rename", weechat_tcl_api_config_option_rename, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp,"weechat::config_option_is_null", + weechat_tcl_api_config_option_is_null, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp,"weechat::config_option_default_is_null", + weechat_tcl_api_config_option_default_is_null, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_boolean", weechat_tcl_api_config_boolean, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_integer", @@ -5336,6 +5481,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp) { weechat_tcl_api_config_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_color", weechat_tcl_api_config_color, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp,"weechat::config_write_option", + weechat_tcl_api_config_write_option, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_write_line", weechat_tcl_api_config_write_line, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_write", diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 3513eca52..416a530c7 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -60,6 +60,9 @@ struct t_weelist; #define WEECHAT_CONFIG_WRITE_ERROR -1 #define WEECHAT_CONFIG_WRITE_MEMORY_ERROR -2 +/* null value for option */ +#define WEECHAT_CONFIG_OPTION_NULL "null" + /* return codes for config option set */ #define WEECHAT_CONFIG_OPTION_SET_OK_CHANGED 2 #define WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE 1 @@ -254,6 +257,7 @@ struct t_weechat_plugin int max, const char *default_value, const char *value, + int null_value_allowed, int (*callback_check_value)(void *data, struct t_config_option *option, const char *value), @@ -282,15 +286,25 @@ struct t_weechat_plugin int run_callback); int (*config_option_set) (struct t_config_option *option, const char *value, int run_callback); + int (*config_option_set_null) (struct t_config_option *option, + int run_callback); int (*config_option_unset) (struct t_config_option *option); void (*config_option_rename) (struct t_config_option *option, const char *new_name); void *(*config_option_get_pointer) (struct t_config_option *option, const char *property); + int (*config_option_is_null) (struct t_config_option *option); + int (*config_option_default_is_null) (struct t_config_option *option); int (*config_boolean) (struct t_config_option *option); + int (*config_boolean_default) (struct t_config_option *option); int (*config_integer) (struct t_config_option *option); + int (*config_integer_default) (struct t_config_option *option); const char *(*config_string) (struct t_config_option *option); + const char *(*config_string_default) (struct t_config_option *option); const char *(*config_color) (struct t_config_option *option); + const char *(*config_color_default) (struct t_config_option *option); + void (*config_write_option) (struct t_config_file *config_file, + struct t_config_option *option); void (*config_write_line) (struct t_config_file *config_file, const char *option_name, const char *value, ...); @@ -761,6 +775,7 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); #define weechat_config_new_option(__config, __section, __name, __type, \ __desc, __string_values, __min, \ __max, __default, __value, \ + __null_value_allowed, \ __callback_check, \ __callback_check_data, \ __callback_change, \ @@ -770,6 +785,7 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); weechat_plugin->config_new_option(__config, __section, __name, \ __type, __desc, __string_values, \ __min, __max, __default, __value, \ + __null_value_allowed, \ __callback_check, \ __callback_check_data, \ __callback_change, \ @@ -797,20 +813,36 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); #define weechat_config_option_set(__option, __value, __run_callback) \ weechat_plugin->config_option_set(__option, __value, \ __run_callback) +#define weechat_config_option_set_null(__option, __run_callback) \ + weechat_plugin->config_option_set_null(__option, __run_callback) #define weechat_config_option_unset(__option) \ weechat_plugin->config_option_unset(__option) #define weechat_config_option_rename(__option, __new_name) \ weechat_plugin->config_option_rename(__option, __new_name) #define weechat_config_option_get_pointer(__option, __property) \ weechat_plugin->config_option_get_pointer(__option, __property) +#define weechat_config_option_is_null(__option) \ + weechat_plugin->config_option_is_null(__option) +#define weechat_config_option_default_is_null(__option) \ + weechat_plugin->config_option_default_is_null(__option) #define weechat_config_boolean(__option) \ weechat_plugin->config_boolean(__option) +#define weechat_config_boolean_default(__option) \ + weechat_plugin->config_boolean_default(__option) #define weechat_config_integer(__option) \ weechat_plugin->config_integer(__option) +#define weechat_config_integer_default(__option) \ + weechat_plugin->config_integer_default(__option) #define weechat_config_string(__option) \ weechat_plugin->config_string(__option) +#define weechat_config_string_default(__option) \ + weechat_plugin->config_string_default(__option) #define weechat_config_color(__option) \ weechat_plugin->config_color(__option) +#define weechat_config_color_default(__option) \ + weechat_plugin->config_color_default(__option) +#define weechat_config_write_option(__config, __option) \ + weechat_plugin->config_write_option(__config, __option) #define weechat_config_write_line(__config, __option, __value...) \ weechat_plugin->config_write_line(__config, __option, ##__value) #define weechat_config_write(__config) \ diff --git a/src/plugins/xfer/xfer-config.c b/src/plugins/xfer/xfer-config.c index f4dcdfc45..8f9c15a17 100644 --- a/src/plugins/xfer/xfer-config.c +++ b/src/plugins/xfer/xfer-config.c @@ -124,12 +124,12 @@ xfer_config_init () "auto_open_buffer", "boolean", N_("auto open xfer buffer when a new xfer is added " "to list"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_look_progress_bar_size = weechat_config_new_option ( xfer_config_file, ptr_section, "progress_bar_size", "integer", N_("size of progress bar, in chars (if 0, progress bar is disabled)"), - NULL, 0, XFER_CONFIG_PROGRESS_BAR_MAX_SIZE, "20", NULL, + NULL, 0, XFER_CONFIG_PROGRESS_BAR_MAX_SIZE, "20", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); ptr_section = weechat_config_new_section (xfer_config_file, "color", @@ -147,55 +147,55 @@ xfer_config_init () xfer_config_file, ptr_section, "text", "color", N_("text color"), - NULL, 0, 0, "default", NULL, + NULL, 0, 0, "default", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_text_bg = weechat_config_new_option ( xfer_config_file, ptr_section, "text_bg", "color", N_("background color"), - NULL, 0, 0, "default", NULL, + NULL, 0, 0, "default", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_text_selected = weechat_config_new_option ( xfer_config_file, ptr_section, "text_selected", "color", N_("text color of selected xfer line"), - NULL, 0, 0, "white", NULL, + NULL, 0, 0, "white", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_status[XFER_STATUS_WAITING] = weechat_config_new_option ( xfer_config_file, ptr_section, "status_waiting", "color", N_("text color for \"waiting\" status"), - NULL, 0, 0, "lightcyan", NULL, + NULL, 0, 0, "lightcyan", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_status[XFER_STATUS_CONNECTING] = weechat_config_new_option ( xfer_config_file, ptr_section, "status_connecting", "color", N_("text color for \"connecting\" status"), - NULL, 0, 0, "yellow", NULL, + NULL, 0, 0, "yellow", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_status[XFER_STATUS_ACTIVE] = weechat_config_new_option ( xfer_config_file, ptr_section, "status_active", "color", N_("text color for \"active\" status"), - NULL, 0, 0, "lightblue", NULL, + NULL, 0, 0, "lightblue", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_status[XFER_STATUS_DONE] = weechat_config_new_option ( xfer_config_file, ptr_section, "status_done", "color", N_("text color for \"done\" status"), - NULL, 0, 0, "lightgreen", NULL, + NULL, 0, 0, "lightgreen", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_status[XFER_STATUS_FAILED] = weechat_config_new_option ( xfer_config_file, ptr_section, "status_failed", "color", N_("text color for \"failed\" status"), - NULL, 0, 0, "lightred", NULL, + NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); xfer_config_color_status[XFER_STATUS_ABORTED] = weechat_config_new_option ( xfer_config_file, ptr_section, "status_aborted", "color", N_("text color for \"aborted\" status"), - NULL, 0, 0, "lightred", NULL, + NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, &xfer_config_refresh_cb, NULL, NULL, NULL); ptr_section = weechat_config_new_section (xfer_config_file, "network", @@ -213,37 +213,37 @@ xfer_config_init () xfer_config_file, ptr_section, "timeout", "integer", N_("timeout for xfer request (in seconds)"), - NULL, 5, INT_MAX, "300", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 5, INT_MAX, "300", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_network_blocksize = weechat_config_new_option ( xfer_config_file, ptr_section, "blocksize", "integer", N_("block size for sending packets, in bytes"), - NULL, XFER_BLOCKSIZE_MIN, XFER_BLOCKSIZE_MAX, "65536", NULL, + NULL, XFER_BLOCKSIZE_MIN, XFER_BLOCKSIZE_MAX, "65536", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_network_fast_send = weechat_config_new_option ( xfer_config_file, ptr_section, "fast_send", "boolean", N_("does not wait for ACK when sending file"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_network_port_range = weechat_config_new_option ( xfer_config_file, ptr_section, "port_range", "string", N_("restricts outgoing files/chats to use only ports in the given " "range (useful for NAT) (syntax: a single port, ie. 5000 or a port " "range, ie. 5000-5015, empty value means any port)"), - NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_network_own_ip = weechat_config_new_option ( xfer_config_file, ptr_section, "own_ip", "string", N_("IP or DNS address used for sending files/chats " "(if empty, local interface IP is used)"), - NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_network_speed_limit = weechat_config_new_option ( xfer_config_file, ptr_section, "speed_limit", "integer", N_("speed limit for sending files, in kilo-bytes by second (0 means " "no limit)"), - NULL, 0, INT_MAX, "0", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, INT_MAX, "0", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); ptr_section = weechat_config_new_section (xfer_config_file, "file", 0, 0, @@ -260,44 +260,44 @@ xfer_config_init () xfer_config_file, ptr_section, "download_path", "string", N_("path for writing incoming files"), - NULL, 0, 0, "%h/xfer", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "%h/xfer", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_upload_path = weechat_config_new_option ( xfer_config_file, ptr_section, "upload_path", "string", N_("path for reading files when sending (when no path is " "specified by user)"), - NULL, 0, 0, "~", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "~", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_use_nick_in_filename = weechat_config_new_option ( xfer_config_file, ptr_section, "use_nick_in_filename", "boolean", N_("use remote nick as prefix in local filename when receiving a file"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_convert_spaces = weechat_config_new_option ( xfer_config_file, ptr_section, "convert_spaces", "boolean", N_("convert spaces to underscores when sending files"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_auto_rename = weechat_config_new_option ( xfer_config_file, ptr_section, "auto_rename", "boolean", N_("rename incoming files if already exists (add '.1', '.2', ...)"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_auto_resume = weechat_config_new_option ( xfer_config_file, ptr_section, "auto_resume", "boolean", N_("automatically resume file transfer if connection with remote host " "is lost"), - NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_auto_accept_files = weechat_config_new_option ( xfer_config_file, ptr_section, "auto_accept_files", "boolean", N_("automatically accept incoming files (use carefully!)"), - NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); xfer_config_file_auto_accept_chats = weechat_config_new_option ( xfer_config_file, ptr_section, "auto_accept_chats", "boolean", N_("automatically accept chat requests (use carefully!)"), - NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); return 1; } |