diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-09-09 08:54:33 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-09-09 08:54:33 +0200 |
commit | d9555cc5679eebbfa8d5d03c34a6f63e516c7a04 (patch) | |
tree | e647dfb2e0acbd1f1c493de96ed25550a0d2b9a1 /src/plugins/javascript/weechat-js-api.cpp | |
parent | 9fada89f96f7b702b8d4c9927badb7155a0c8adf (diff) | |
download | weechat-d9555cc5679eebbfa8d5d03c34a6f63e516c7a04.zip |
scripts: add functions config_enum and config_enum_default in scripting API (issue #1973)
Diffstat (limited to 'src/plugins/javascript/weechat-js-api.cpp')
-rw-r--r-- | src/plugins/javascript/weechat-js-api.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp index c6aabe0fe..df916b95d 100644 --- a/src/plugins/javascript/weechat-js-api.cpp +++ b/src/plugins/javascript/weechat-js-api.cpp @@ -1565,6 +1565,34 @@ API_FUNC(config_color_default) API_RETURN_STRING(result); } +API_FUNC(config_enum) +{ + int value; + + API_INIT_FUNC(1, "config_enum", "s", API_RETURN_INT(0)); + + v8::String::Utf8Value option(args[0]); + + value = weechat_config_enum ( + (struct t_config_option *)API_STR2PTR(*option)); + + API_RETURN_INT(value); +} + +API_FUNC(config_enum_default) +{ + int value; + + API_INIT_FUNC(1, "config_enum_default", "s", API_RETURN_INT(0)); + + v8::String::Utf8Value option(args[0]); + + value = weechat_config_enum_default ( + (struct t_config_option *)API_STR2PTR(*option)); + + API_RETURN_INT(value); +} + API_FUNC(config_write_option) { API_INIT_FUNC(1, "config_write_option", "ss", API_RETURN_ERROR); @@ -5170,6 +5198,8 @@ WeechatJsV8::loadLibs() API_DEF_FUNC(config_string_default); API_DEF_FUNC(config_color); API_DEF_FUNC(config_color_default); + API_DEF_FUNC(config_enum); + API_DEF_FUNC(config_enum_default); API_DEF_FUNC(config_write_option); API_DEF_FUNC(config_write_line); API_DEF_FUNC(config_write); |