1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 07:46:38 +02:00

scripts: add functions config_enum and config_enum_default in scripting API (issue #1973)

This commit is contained in:
Sébastien Helleu
2023-09-09 08:54:33 +02:00
parent 9fada89f96
commit d9555cc567
14 changed files with 280 additions and 2 deletions
+40
View File
@@ -2000,6 +2000,44 @@ weechat_ruby_api_config_color_default (VALUE class, VALUE option)
API_RETURN_STRING(result);
}
static VALUE
weechat_ruby_api_config_enum (VALUE class, VALUE option)
{
char *c_option;
int value;
API_INIT_FUNC(1, "config_enum", API_RETURN_INT(0));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (option, T_STRING);
c_option = StringValuePtr (option);
value = weechat_config_enum (API_STR2PTR(c_option));
API_RETURN_INT(value);
}
static VALUE
weechat_ruby_api_config_enum_default (VALUE class, VALUE option)
{
char *c_option;
int value;
API_INIT_FUNC(1, "config_enum_default", API_RETURN_INT(0));
if (NIL_P (option))
API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (option, T_STRING);
c_option = StringValuePtr (option);
value = weechat_config_enum_default (API_STR2PTR(c_option));
API_RETURN_INT(value);
}
static VALUE
weechat_ruby_api_config_write_option (VALUE class, VALUE config_file,
VALUE option)
@@ -6691,6 +6729,8 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
API_DEF_FUNC(config_string_default, 1);
API_DEF_FUNC(config_color, 1);
API_DEF_FUNC(config_color_default, 1);
API_DEF_FUNC(config_enum, 1);
API_DEF_FUNC(config_enum_default, 1);
API_DEF_FUNC(config_write_option, 2);
API_DEF_FUNC(config_write_line, 3);
API_DEF_FUNC(config_write, 1);