summaryrefslogtreecommitdiff
path: root/doc/en
diff options
context:
space:
mode:
Diffstat (limited to 'doc/en')
-rw-r--r--doc/en/weechat_plugin_api.en.adoc194
-rw-r--r--doc/en/weechat_user.en.adoc22
2 files changed, 157 insertions, 59 deletions
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc
index d6d264fa5..ac6b91643 100644
--- a/doc/en/weechat_plugin_api.en.adoc
+++ b/doc/en/weechat_plugin_api.en.adoc
@@ -6880,7 +6880,7 @@ section = weechat.config_search_section(config_file, "section")
==== config_new_option
-_Updated in 1.5._
+_Updated in 1.5, 4.1.0._
Create a new option in a section of a configuration file.
@@ -6928,12 +6928,13 @@ Arguments:
"name << file.section.option"
* _type_: type of option:
** _boolean_: boolean value (on/off)
-** _integer_: integer value (with optional strings for values)
+** _integer_: integer value
** _string_: string value
** _color_: color
+** _enum_: list of string values (stored as integer internally)
* _description_: description of option
-* _string_values_: values as string (separated by `+|+`), used for type
- _integer_ (optional)
+* _string_values_: values as string (separated by `+|+`) (optional, required
+ for type _enum_)
* _min_: minimum value (for type _integer_)
* _max_: maximum value (for type _integer_)
* _default_value_: default value for option (used when option is reset)
@@ -6984,8 +6985,8 @@ C example:
[source,c]
----
/* boolean */
-struct t_config_option *option1 =
- weechat_config_new_option (config_file, section, "option1", "boolean",
+struct t_config_option *option_bool =
+ weechat_config_new_option (config_file, section, "option_bool", "boolean",
"My option, type boolean",
NULL,
0, 0,
@@ -6997,8 +6998,8 @@ struct t_config_option *option1 =
NULL, NULL, NULL);
/* integer */
-struct t_config_option *option2 =
- weechat_config_new_option (config_file, section, "option2", "integer",
+struct t_config_option *option_int =
+ weechat_config_new_option (config_file, section, "option_int", "integer",
"My option, type integer",
NULL,
0, 100,
@@ -7009,22 +7010,9 @@ struct t_config_option *option2 =
NULL, NULL, NULL,
NULL, NULL, NULL);
-/* integer (with string values) */
-struct t_config_option *option3 =
- weechat_config_new_option (config_file, section, "option3", "integer",
- "My option, type integer (with string values)",
- "top|bottom|left|right",
- 0, 0,
- "bottom",
- "bottom",
- 0,
- NULL, NULL, NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL);
-
/* string */
-struct t_config_option *option4 =
- weechat_config_new_option (config_file, section, "option4", "string",
+struct t_config_option *option_str =
+ weechat_config_new_option (config_file, section, "option_str", "string",
"My option, type string",
NULL,
0, 0,
@@ -7036,8 +7024,8 @@ struct t_config_option *option4 =
NULL, NULL, NULL);
/* color */
-struct t_config_option *option5 =
- weechat_config_new_option (config_file, section, "option5", "color",
+struct t_config_option *option_col =
+ weechat_config_new_option (config_file, section, "option_col", "color",
"My option, type color",
NULL,
0, 0,
@@ -7047,6 +7035,19 @@ struct t_config_option *option5 =
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
+
+/* enum */
+struct t_config_option *option_enum =
+ weechat_config_new_option (config_file, section, "option_enum", "enum",
+ "My option, type enum",
+ "top|bottom|left|right",
+ 0, 0,
+ "bottom",
+ "bottom",
+ 0,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL);
----
Script (Python):
@@ -7062,52 +7063,52 @@ def config_new_option(config_file: str, section: str, name: str, type: str, desc
callback_delete: str, callback_delete_data: str) -> str: ...
# example
-def option4_check_value_cb(data: str, option: str, value: str) -> int:
+def option_str_check_value_cb(data: str, option: str, value: str) -> int:
# ...
return 1
# return 0
-def option4_change_cb(data: str, option: str) -> None:
+def option_str_change_cb(data: str, option: str) -> None:
# ...
-def option4_delete_cb(data: str, option: str) -> None:
+def option_str_delete_cb(data: str, option: str) -> None:
# ...
-option1 = weechat.config_new_option(config_file, section, "option1", "boolean",
+option_bool = weechat.config_new_option(config_file, section, "option_bool", "boolean",
"My option, type boolean",
"", 0, 0, "on", "on", 0,
"", "",
"", "",
"", "")
-option2 = weechat.config_new_option(config_file, section, "option2", "integer",
+option_int = weechat.config_new_option(config_file, section, "option_int", "integer",
"My option, type integer",
"", 0, 100, "15", "15", 0,
"", "",
"", "",
"", "")
-option3 = weechat.config_new_option(config_file, section, "option3", "integer",
- "My option, type integer (with string values)",
- "top|bottom|left|right",
- 0, 0, "bottom", "bottom", 0,
- "", "",
- "", "",
- "", "")
-
-option4 = weechat.config_new_option(config_file, section, "option4", "string",
+option_str = weechat.config_new_option(config_file, section, "option_str", "string",
"My option, type string",
"", 0, 0, "test", "test", 1,
- "option4_check_value_cb", "",
- "option4_change_cb", "",
- "option4_delete_cb", "")
+ "option_str_check_value_cb", "",
+ "option_str_change_cb", "",
+ "option_str_delete_cb", "")
-option5 = weechat.config_new_option(config_file, section, "option5", "color",
+option_col = weechat.config_new_option(config_file, section, "option_col", "color",
"My option, type color",
"", 0, 0, "lightblue", "lightblue", 0,
"", "",
"", "",
"", "")
+
+option_enum = weechat.config_new_option(config_file, section, "option_enum", "enum",
+ "My option, type enum",
+ "top|bottom|left|right",
+ 0, 0, "bottom", "bottom", 0,
+ "", "",
+ "", "",
+ "", "")
----
[NOTE]
@@ -7387,7 +7388,7 @@ Arguments:
type of option:
** _boolean_:
*** `toggle`: toggle the current value
-** _integer_ or _color_:
+** _integer_, _color_ or _enum_:
*** `++N`: add `N` (any integer) to the current value
*** `--N`: subtract `N` (any integer) from the current value
* _run_callback_: 1 for calling change callback if value of option is changed,
@@ -7621,6 +7622,7 @@ Arguments:
*** _integer_
*** _string_
*** _color_
+*** _enum_
** _description_: option description
Return value:
@@ -7794,6 +7796,7 @@ Return value, depending on the option type:
* _integer_: 0
* _string_: 0
* _color_: 0
+* _enum_: 0
C example:
@@ -7844,6 +7847,7 @@ Return value, depending on the option type:
* _integer_: 0
* _string_: 0
* _color_: 0
+* _enum_: 0
C example:
@@ -7894,6 +7898,7 @@ Return value, depending on the option type:
* _integer_: integer value of option
* _string_: 0
* _color_: color index
+* _enum_: integer value of option (index of enum value)
C example:
@@ -7936,6 +7941,7 @@ Return value, depending on the option type:
* _integer_: default integer value of option
* _string_: 0
* _color_: default color index
+* _enum_: default integer value of option (index of enum value)
C example:
@@ -7975,10 +7981,10 @@ Arguments:
Return value, depending on the option type:
* _boolean_: "on" if value is true, otherwise "off"
-* _integer_: string value if the option is an integer with string values,
- otherwise NULL
+* _integer_: NULL
* _string_: string value of option
* _color_: name of color
+* _enum_: string value of option
C example:
@@ -8018,10 +8024,10 @@ Arguments:
Return value, depending on the option type:
* _boolean_: "on" if default value is true, otherwise "off"
-* _integer_: default string value if the option is an integer with string
- values, otherwise NULL
+* _integer_: NULL
* _string_: default string value of option
* _color_: name of default color
+* _enum_: default string value of option
C example:
@@ -8064,6 +8070,7 @@ Return value, depending on the option type:
* _integer_: NULL
* _string_: NULL
* _color_: name of color
+* _enum_: NULL
C example:
@@ -8106,6 +8113,7 @@ Return value, depending on the option type:
* _integer_: NULL
* _string_: NULL
* _color_: name of default color
+* _enum_: NULL
C example:
@@ -8127,6 +8135,96 @@ option = weechat.config_get("plugin.section.option")
value = weechat.config_color_default(option)
----
+==== config_enum
+
+_WeeChat ≥ 4.1.0._
+
+Return enum value of option, as integer.
+
+Prototype:
+
+[source,c]
+----
+int weechat_config_enum (struct t_config_option *option);
+----
+
+Arguments:
+
+* _option_: option pointer
+
+Return value, depending on the option type:
+
+* _boolean_: boolean value of option (0 or 1)
+* _integer_: integer value of option
+* _string_: 0
+* _color_: color index
+* _enum_: integer value of option (index of enum value)
+
+C example:
+
+[source,c]
+----
+struct t_config_option *option = weechat_config_get ("plugin.section.option");
+int value = weechat_config_enum (option);
+----
+
+Script (Python):
+
+[source,python]
+----
+# prototype
+def config_enum(option: str) -> int: ...
+
+# example
+option = weechat.config_get("plugin.section.option")
+value = weechat.config_enum(option)
+----
+
+==== config_enum_default
+
+_WeeChat ≥ 4.1.0._
+
+Return default enum value of option, as integer.
+
+Prototype:
+
+[source,c]
+----
+int weechat_config_enum_default (struct t_config_option *option);
+----
+
+Arguments:
+
+* _option_: option pointer
+
+Return value, depending on the option type:
+
+* _boolean_: default boolean value of option (0 or 1)
+* _integer_: default integer value of option
+* _string_: 0
+* _color_: default color index
+* _enum_: integer value of option (index of enum value)
+
+C example:
+
+[source,c]
+----
+struct t_config_option *option = weechat_config_get ("plugin.section.option");
+int value = weechat_config_enum_default (option);
+----
+
+Script (Python):
+
+[source,python]
+----
+# prototype
+def config_enum_default(option: str) -> int: ...
+
+# example
+option = weechat.config_get("plugin.section.option")
+value = weechat.config_enum_default(option)
+----
+
==== config_write_option
Write a line in a configuration file with option and its value (this function
diff --git a/doc/en/weechat_user.en.adoc b/doc/en/weechat_user.en.adoc
index d8fbb43c4..cb1496868 100644
--- a/doc/en/weechat_user.en.adoc
+++ b/doc/en/weechat_user.en.adoc
@@ -1710,8 +1710,8 @@ These mouse actions are possible only if mouse is enabled with key kbd:[Alt+m]
| kbd:[▼] | - | chat: fset buffer | Move five lines down in fset buffer. | `+/fset -down 5+`
| ◾◽◽ | - | chat: fset buffer | Select line in fset buffer. | `+/window ${_window_number};/fset -go ${_chat_line_y}+`
| ◽◽◾ | - | chat: fset buffer | Toggle boolean (on/off) or edit the option value. | `+hsignal:fset_mouse+`
-| ◽◽◾ | left | chat: fset buffer | Decrease value for integer/color, set/append to value for other types. | `+hsignal:fset_mouse+`
-| ◽◽◾ | right | chat: fset buffer | Increase value for integer/color, set/append to value for other types. | `+hsignal:fset_mouse+`
+| ◽◽◾ | left | chat: fset buffer | Decrease value for integer/color/enum, set/append to value for other types. | `+hsignal:fset_mouse+`
+| ◽◽◾ | right | chat: fset buffer | Increase value for integer/color/enum, set/append to value for other types. | `+hsignal:fset_mouse+`
| ◽◽◾ | up / down | chat: fset buffer | Mark/unmark multiple options. | `+hsignal:fset_mouse+`
| kbd:[▲] | - | chat: script buffer | Move five lines up in script buffer. | `+/script up 5+`
| kbd:[▼] | - | chat: script buffer | Move five lines down in script buffer. | `+/script down 5+`
@@ -1758,8 +1758,8 @@ These keys and actions are used on the fset buffer (see <<fset,Fset plugin>>).
| kbd:[F11] | `pass:[<]` | Scroll horizontally on the left. | `+/fset -left+`
| kbd:[F12] | `pass:[>]` | Scroll horizontally on the right. | `+/fset -right+`
| kbd:[Alt+Space] | `t` | Toggle boolean value. | `+/fset -toggle+`
-| kbd:[Alt+-] | `-` | Subtract 1 from value for integer/color, set value for other types. | `+/fset -add -1+`
-| kbd:[Alt++] | `+` | Add 1 to value for integer/color, append to value for other types. | `+/fset -add 1+`
+| kbd:[Alt+-] | `-` | Subtract 1 from value for integer/color/enum, set value for other types. | `+/fset -add -1+`
+| kbd:[Alt++] | `+` | Add 1 to value for integer/color/enum, append to value for other types. | `+/fset -add 1+`
| kbd:[Alt+f], kbd:[Alt+r] | `r` | Reset value. | `+/fset -reset+`
| kbd:[Alt+f], kbd:[Alt+u] | `u` | Unset value. | `+/fset -unset+`
| kbd:[Alt+Enter] | `s` | Set value. | `+/fset -set+`
@@ -1829,7 +1829,7 @@ Example of fset buffer displaying options starting with `weechat.look` :
│2.fset │weechat.look.bare_display_exit_on_input: exit the bare display mode on any c│
│ │hanges in input [default: on] │
│ │----------------------------------------------------------------------------│
-│ │ weechat.look.align_end_of_lines integer message │
+│ │ weechat.look.align_end_of_lines enum message │
│ │ weechat.look.align_multiline_words boolean on │
│ │ weechat.look.bar_more_down string "++" │
│ │ weechat.look.bar_more_left string "<<" │
@@ -1838,12 +1838,12 @@ Example of fset buffer displaying options starting with `weechat.look` :
│ │## weechat.look.bare_display_exit_on_input boolean on ##│
│ │ weechat.look.bare_display_time_format string "%H:%M" │
│ │ weechat.look.buffer_auto_renumber boolean on │
-│ │ weechat.look.buffer_notify_default integer all │
-│ │ weechat.look.buffer_position integer end │
+│ │ weechat.look.buffer_notify_default enum all │
+│ │ weechat.look.buffer_position enum end │
│ │ weechat.look.buffer_search_case_sensitive boolean off │
│ │ weechat.look.buffer_search_force_default boolean off │
│ │ weechat.look.buffer_search_regex boolean off │
-│ │ weechat.look.buffer_search_where integer prefix_message │
+│ │ weechat.look.buffer_search_where enum prefix_message │
│ │ weechat.look.buffer_time_format string "%H:%M:%S" │
│ │ weechat.look.buffer_time_same string "" │
│ │[12:55] [2] [fset] 2:fset │
@@ -3264,7 +3264,7 @@ irc.server.libera.autorejoin_delay integer null -> 30
irc.server.libera.away_check integer null -> 0
irc.server.libera.away_check_max_nicks integer null -> 25
irc.server.libera.capabilities string null -> "*"
-irc.server.libera.charset_message integer null -> message
+irc.server.libera.charset_message enum null -> message
irc.server.libera.command string null -> ""
irc.server.libera.command_delay integer null -> 0
irc.server.libera.connection_timeout integer null -> 60
@@ -3280,9 +3280,9 @@ irc.server.libera.notify string null -> ""
irc.server.libera.password string null -> ""
irc.server.libera.proxy string null -> ""
irc.server.libera.realname string null -> ""
-irc.server.libera.sasl_fail integer null -> reconnect
+irc.server.libera.sasl_fail enum null -> reconnect
irc.server.libera.sasl_key string null -> ""
-irc.server.libera.sasl_mechanism integer null -> plain
+irc.server.libera.sasl_mechanism enum null -> plain
irc.server.libera.sasl_password string "${sec.data.libera}"
irc.server.libera.sasl_timeout integer null -> 15
irc.server.libera.sasl_username string "alice"