1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 20:36:38 +02:00

api: add functions config_{boolean|integer|string|color|enum}_inherited in scripting API

This commit is contained in:
Sébastien Helleu
2024-03-04 18:42:41 +01:00
parent 8f0b3ab9c7
commit 361d55d9d7
33 changed files with 2328 additions and 24 deletions
+83
View File
@@ -1651,6 +1651,22 @@ API_FUNC(config_boolean_default)
API_RETURN_INT(value);
}
API_FUNC(config_boolean_inherited)
{
const char *option;
int value;
API_INIT_FUNC(1, "config_boolean_inherited", API_RETURN_INT(0));
if (lua_gettop (L) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (L, -1);
value = weechat_config_boolean_inherited (API_STR2PTR(option));
API_RETURN_INT(value);
}
API_FUNC(config_integer)
{
const char *option;
@@ -1683,6 +1699,22 @@ API_FUNC(config_integer_default)
API_RETURN_INT(value);
}
API_FUNC(config_integer_inherited)
{
const char *option;
int value;
API_INIT_FUNC(1, "config_integer_inherited", API_RETURN_INT(0));
if (lua_gettop (L) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (L, -1);
value = weechat_config_integer_inherited (API_STR2PTR(option));
API_RETURN_INT(value);
}
API_FUNC(config_string)
{
const char *option, *result;
@@ -1713,6 +1745,21 @@ API_FUNC(config_string_default)
API_RETURN_STRING(result);
}
API_FUNC(config_string_inherited)
{
const char *option, *result;
API_INIT_FUNC(1, "config_string_inherited", API_RETURN_EMPTY);
if (lua_gettop (L) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
option = lua_tostring (L, -1);
result = weechat_config_string_inherited (API_STR2PTR(option));
API_RETURN_STRING(result);
}
API_FUNC(config_color)
{
const char *option, *result;
@@ -1743,6 +1790,21 @@ API_FUNC(config_color_default)
API_RETURN_STRING(result);
}
API_FUNC(config_color_inherited)
{
const char *option, *result;
API_INIT_FUNC(1, "config_color_inherited", API_RETURN_EMPTY);
if (lua_gettop (L) < 1)
API_WRONG_ARGS(API_RETURN_EMPTY);
option = lua_tostring (L, -1);
result = weechat_config_color_inherited (API_STR2PTR(option));
API_RETURN_STRING(result);
}
API_FUNC(config_enum)
{
const char *option;
@@ -1775,6 +1837,22 @@ API_FUNC(config_enum_default)
API_RETURN_INT(value);
}
API_FUNC(config_enum_inherited)
{
const char *option;
int value;
API_INIT_FUNC(1, "config_enum_inherited", API_RETURN_INT(0));
if (lua_gettop (L) < 1)
API_WRONG_ARGS(API_RETURN_INT(0));
option = lua_tostring (L, -1);
value = weechat_config_enum_inherited (API_STR2PTR(option));
API_RETURN_INT(value);
}
API_FUNC(config_write_option)
{
const char *config_file, *option;
@@ -5727,14 +5805,19 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
API_DEF_FUNC(config_option_default_is_null),
API_DEF_FUNC(config_boolean),
API_DEF_FUNC(config_boolean_default),
API_DEF_FUNC(config_boolean_inherited),
API_DEF_FUNC(config_integer),
API_DEF_FUNC(config_integer_default),
API_DEF_FUNC(config_integer_inherited),
API_DEF_FUNC(config_string),
API_DEF_FUNC(config_string_default),
API_DEF_FUNC(config_string_inherited),
API_DEF_FUNC(config_color),
API_DEF_FUNC(config_color_default),
API_DEF_FUNC(config_color_inherited),
API_DEF_FUNC(config_enum),
API_DEF_FUNC(config_enum_default),
API_DEF_FUNC(config_enum_inherited),
API_DEF_FUNC(config_write_option),
API_DEF_FUNC(config_write_line),
API_DEF_FUNC(config_write),