diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-03-03 10:32:11 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-03-05 19:51:15 +0100 |
commit | c3eff15a566da40e1919b034cd5580378dd3bda7 (patch) | |
tree | ebea7d1d9eff1efdd5069f9e4ffb61b1852408a0 /src/plugins/python | |
parent | 0bf560f9b72f4cb268132399db135cb33bb529cf (diff) | |
download | weechat-c3eff15a566da40e1919b034cd5580378dd3bda7.zip |
api: add functions config_option_get_string and config_option_get_pointer in scripting API
Diffstat (limited to 'src/plugins/python')
-rw-r--r-- | src/plugins/python/weechat-python-api.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index 068981bdd..d4a1118c4 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -1480,6 +1480,39 @@ API_FUNC(config_option_rename) API_RETURN_OK; } +API_FUNC(config_option_get_string) +{ + char *option, *property; + const char *result; + + API_INIT_FUNC(1, "config_option_get_string", API_RETURN_EMPTY); + option = NULL; + property = NULL; + if (!PyArg_ParseTuple (args, "ss", &option, &property)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result = weechat_config_option_get_string (API_STR2PTR(option), property); + + API_RETURN_STRING(result); +} + +API_FUNC(config_option_get_pointer) +{ + char *option, *property; + const char *result; + + API_INIT_FUNC(1, "config_option_get_pointer", API_RETURN_EMPTY); + option = NULL; + property = NULL; + if (!PyArg_ParseTuple (args, "ss", &option, &property)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result = API_PTR2STR(weechat_config_option_get_pointer (API_STR2PTR(option), + property)); + + API_RETURN_STRING(result); +} + API_FUNC(config_option_is_null) { char *option; @@ -5552,6 +5585,8 @@ PyMethodDef weechat_python_funcs[] = API_DEF_FUNC(config_option_set_null), API_DEF_FUNC(config_option_unset), API_DEF_FUNC(config_option_rename), + API_DEF_FUNC(config_option_get_string), + API_DEF_FUNC(config_option_get_pointer), API_DEF_FUNC(config_option_is_null), API_DEF_FUNC(config_option_default_is_null), API_DEF_FUNC(config_boolean), |