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/python | |
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/python')
-rw-r--r-- | src/plugins/python/weechat-python-api.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index d0d241b36..9ffac5b3b 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -1630,6 +1630,36 @@ API_FUNC(config_color_default) API_RETURN_STRING(result); } +API_FUNC(config_enum) +{ + char *option; + int value; + + API_INIT_FUNC(1, "config_enum", API_RETURN_INT(0)); + option = NULL; + if (!PyArg_ParseTuple (args, "s", &option)) + API_WRONG_ARGS(API_RETURN_INT(0)); + + value = weechat_config_enum (API_STR2PTR(option)); + + API_RETURN_INT(value); +} + +API_FUNC(config_enum_default) +{ + char *option; + int value; + + API_INIT_FUNC(1, "config_enum_default", API_RETURN_INT(0)); + option = NULL; + if (!PyArg_ParseTuple (args, "s", &option)) + API_WRONG_ARGS(API_RETURN_INT(0)); + + value = weechat_config_enum_default (API_STR2PTR(option)); + + API_RETURN_INT(value); +} + API_FUNC(config_write_option) { char *config_file, *option; @@ -5396,6 +5426,8 @@ PyMethodDef weechat_python_funcs[] = 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), |