From 361d55d9d7d8f072802d6b4dc4ebbc9f483e958e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Mon, 4 Mar 2024 18:42:41 +0100 Subject: api: add functions config_{boolean|integer|string|color|enum}_inherited in scripting API --- src/plugins/php/weechat-php-api.c | 85 ++++++++++++++++++++++++++++ src/plugins/php/weechat-php-api.h | 5 ++ src/plugins/php/weechat-php.c | 5 ++ src/plugins/php/weechat-php.stub.php | 5 ++ src/plugins/php/weechat-php_arginfo.h | 12 +++- src/plugins/php/weechat-php_legacy_arginfo.h | 12 +++- 6 files changed, 122 insertions(+), 2 deletions(-) (limited to 'src/plugins/php') diff --git a/src/plugins/php/weechat-php-api.c b/src/plugins/php/weechat-php-api.c index bc6328f42..43ec87cab 100644 --- a/src/plugins/php/weechat-php-api.c +++ b/src/plugins/php/weechat-php-api.c @@ -1679,6 +1679,23 @@ API_FUNC(config_boolean_default) API_RETURN_INT(result); } +API_FUNC(config_boolean_inherited) +{ + zend_string *z_option; + struct t_config_option *option; + int result; + + API_INIT_FUNC(1, "config_boolean_inherited", API_RETURN_INT(0)); + if (zend_parse_parameters (ZEND_NUM_ARGS(), "S", &z_option) == FAILURE) + API_WRONG_ARGS(API_RETURN_INT(0)); + + option = (struct t_config_option *)API_STR2PTR(ZSTR_VAL(z_option)); + + result = weechat_config_boolean_inherited (option); + + API_RETURN_INT(result); +} + API_FUNC(config_integer) { zend_string *z_option; @@ -1713,6 +1730,23 @@ API_FUNC(config_integer_default) API_RETURN_INT(result); } +API_FUNC(config_integer_inherited) +{ + zend_string *z_option; + struct t_config_option *option; + int result; + + API_INIT_FUNC(1, "config_integer_inherited", API_RETURN_INT(0)); + if (zend_parse_parameters (ZEND_NUM_ARGS(), "S", &z_option) == FAILURE) + API_WRONG_ARGS(API_RETURN_INT(0)); + + option = (struct t_config_option *)API_STR2PTR(ZSTR_VAL(z_option)); + + result = weechat_config_integer_inherited (option); + + API_RETURN_INT(result); +} + API_FUNC(config_string) { zend_string *z_option; @@ -1747,6 +1781,23 @@ API_FUNC(config_string_default) API_RETURN_STRING(result); } +API_FUNC(config_string_inherited) +{ + zend_string *z_option; + struct t_config_option *option; + const char *result; + + API_INIT_FUNC(1, "config_string_inherited", API_RETURN_EMPTY); + if (zend_parse_parameters (ZEND_NUM_ARGS(), "S", &z_option) == FAILURE) + API_WRONG_ARGS(API_RETURN_EMPTY); + + option = (struct t_config_option *)API_STR2PTR(ZSTR_VAL(z_option)); + + result = weechat_config_string_inherited (option); + + API_RETURN_STRING(result); +} + API_FUNC(config_color) { zend_string *z_option; @@ -1781,6 +1832,23 @@ API_FUNC(config_color_default) API_RETURN_STRING(result); } +API_FUNC(config_color_inherited) +{ + zend_string *z_option; + struct t_config_option *option; + const char *result; + + API_INIT_FUNC(1, "config_color_inherited", API_RETURN_EMPTY); + if (zend_parse_parameters (ZEND_NUM_ARGS(), "S", &z_option) == FAILURE) + API_WRONG_ARGS(API_RETURN_EMPTY); + + option = (struct t_config_option *)API_STR2PTR(ZSTR_VAL(z_option)); + + result = weechat_config_color_inherited (option); + + API_RETURN_STRING(result); +} + API_FUNC(config_enum) { zend_string *z_option; @@ -1815,6 +1883,23 @@ API_FUNC(config_enum_default) API_RETURN_INT(result); } +API_FUNC(config_enum_inherited) +{ + zend_string *z_option; + struct t_config_option *option; + int result; + + API_INIT_FUNC(1, "config_enum_inherited", API_RETURN_INT(0)); + if (zend_parse_parameters (ZEND_NUM_ARGS(), "S", &z_option) == FAILURE) + API_WRONG_ARGS(API_RETURN_INT(0)); + + option = (struct t_config_option *)API_STR2PTR(ZSTR_VAL(z_option)); + + result = weechat_config_enum_inherited (option); + + API_RETURN_INT(result); +} + API_FUNC(config_write_option) { zend_string *z_config_file, *z_option; diff --git a/src/plugins/php/weechat-php-api.h b/src/plugins/php/weechat-php-api.h index 40b8dd1aa..240053c4e 100644 --- a/src/plugins/php/weechat-php-api.h +++ b/src/plugins/php/weechat-php-api.h @@ -102,14 +102,19 @@ PHP_FUNCTION(weechat_config_option_is_null); PHP_FUNCTION(weechat_config_option_default_is_null); PHP_FUNCTION(weechat_config_boolean); PHP_FUNCTION(weechat_config_boolean_default); +PHP_FUNCTION(weechat_config_boolean_inherited); PHP_FUNCTION(weechat_config_integer); PHP_FUNCTION(weechat_config_integer_default); +PHP_FUNCTION(weechat_config_integer_inherited); PHP_FUNCTION(weechat_config_string); PHP_FUNCTION(weechat_config_string_default); +PHP_FUNCTION(weechat_config_string_inherited); PHP_FUNCTION(weechat_config_color); PHP_FUNCTION(weechat_config_color_default); +PHP_FUNCTION(weechat_config_color_inherited); PHP_FUNCTION(weechat_config_enum); PHP_FUNCTION(weechat_config_enum_default); +PHP_FUNCTION(weechat_config_enum_inherited); PHP_FUNCTION(weechat_config_write_option); PHP_FUNCTION(weechat_config_write_line); PHP_FUNCTION(weechat_config_write); diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c index 5324d8320..d17aba86f 100644 --- a/src/plugins/php/weechat-php.c +++ b/src/plugins/php/weechat-php.c @@ -160,14 +160,19 @@ const zend_function_entry weechat_functions[] = { PHP_FE(weechat_config_option_default_is_null, arginfo_weechat_config_option_default_is_null) PHP_FE(weechat_config_boolean, arginfo_weechat_config_boolean) PHP_FE(weechat_config_boolean_default, arginfo_weechat_config_boolean_default) + PHP_FE(weechat_config_boolean_inherited, arginfo_weechat_config_boolean_inherited) PHP_FE(weechat_config_integer, arginfo_weechat_config_integer) PHP_FE(weechat_config_integer_default, arginfo_weechat_config_integer_default) + PHP_FE(weechat_config_integer_inherited, arginfo_weechat_config_integer_inherited) PHP_FE(weechat_config_string, arginfo_weechat_config_string) PHP_FE(weechat_config_string_default, arginfo_weechat_config_string_default) + PHP_FE(weechat_config_string_inherited, arginfo_weechat_config_string_inherited) PHP_FE(weechat_config_color, arginfo_weechat_config_color) PHP_FE(weechat_config_color_default, arginfo_weechat_config_color_default) + PHP_FE(weechat_config_color_inherited, arginfo_weechat_config_color_inherited) PHP_FE(weechat_config_enum, arginfo_weechat_config_enum) PHP_FE(weechat_config_enum_default, arginfo_weechat_config_enum_default) + PHP_FE(weechat_config_enum_inherited, arginfo_weechat_config_enum_inherited) PHP_FE(weechat_config_write_option, arginfo_weechat_config_write_option) PHP_FE(weechat_config_write_line, arginfo_weechat_config_write_line) PHP_FE(weechat_config_write, arginfo_weechat_config_write) diff --git a/src/plugins/php/weechat-php.stub.php b/src/plugins/php/weechat-php.stub.php index 32ef0dcca..5ed87ae77 100644 --- a/src/plugins/php/weechat-php.stub.php +++ b/src/plugins/php/weechat-php.stub.php @@ -68,14 +68,19 @@ function weechat_config_option_is_null(string $p0): int {} function weechat_config_option_default_is_null(string $p0): int {} function weechat_config_boolean(string $p0): int {} function weechat_config_boolean_default(string $p0): int {} +function weechat_config_boolean_inherited(string $p0): int {} function weechat_config_integer(string $p0): int {} function weechat_config_integer_default(string $p0): int {} +function weechat_config_integer_inherited(string $p0): int {} function weechat_config_string(string $p0): string {} function weechat_config_string_default(string $p0): string {} +function weechat_config_string_inherited(string $p0): string {} function weechat_config_color(string $p0): string {} function weechat_config_color_default(string $p0): string {} +function weechat_config_color_inherited(string $p0): string {} function weechat_config_enum(string $p0): int {} function weechat_config_enum_default(string $p0): int {} +function weechat_config_enum_inherited(string $p0): int {} function weechat_config_write_option(string $p0, string $p1): int {} function weechat_config_write_line(string $p0, string $p1, string $p2): int {} function weechat_config_write(string $p0): int {} diff --git a/src/plugins/php/weechat-php_arginfo.h b/src/plugins/php/weechat-php_arginfo.h index 225a00abe..a4d83439f 100644 --- a/src/plugins/php/weechat-php_arginfo.h +++ b/src/plugins/php/weechat-php_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2c52caa5a78009856a6e6ced63555d1b1e2be0fe */ + * Stub hash: 59292da89eab98ef1f615c173d9722b9fdafad80 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_weechat_register, 0, 7, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, p0, IS_STRING, 0) @@ -173,22 +173,32 @@ ZEND_END_ARG_INFO() #define arginfo_weechat_config_boolean_default arginfo_weechat_charset_set +#define arginfo_weechat_config_boolean_inherited arginfo_weechat_charset_set + #define arginfo_weechat_config_integer arginfo_weechat_charset_set #define arginfo_weechat_config_integer_default arginfo_weechat_charset_set +#define arginfo_weechat_config_integer_inherited arginfo_weechat_charset_set + #define arginfo_weechat_config_string arginfo_weechat_plugin_get_name #define arginfo_weechat_config_string_default arginfo_weechat_plugin_get_name +#define arginfo_weechat_config_string_inherited arginfo_weechat_plugin_get_name + #define arginfo_weechat_config_color arginfo_weechat_plugin_get_name #define arginfo_weechat_config_color_default arginfo_weechat_plugin_get_name +#define arginfo_weechat_config_color_inherited arginfo_weechat_plugin_get_name + #define arginfo_weechat_config_enum arginfo_weechat_charset_set #define arginfo_weechat_config_enum_default arginfo_weechat_charset_set +#define arginfo_weechat_config_enum_inherited arginfo_weechat_charset_set + #define arginfo_weechat_config_write_option arginfo_weechat_string_has_highlight ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_weechat_config_write_line, 0, 3, IS_LONG, 0) diff --git a/src/plugins/php/weechat-php_legacy_arginfo.h b/src/plugins/php/weechat-php_legacy_arginfo.h index 9b620112b..224fe77f8 100644 --- a/src/plugins/php/weechat-php_legacy_arginfo.h +++ b/src/plugins/php/weechat-php_legacy_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2c52caa5a78009856a6e6ced63555d1b1e2be0fe */ + * Stub hash: 59292da89eab98ef1f615c173d9722b9fdafad80 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_weechat_register, 0, 0, 7) ZEND_ARG_INFO(0, p0) @@ -138,22 +138,32 @@ ZEND_END_ARG_INFO() #define arginfo_weechat_config_boolean_default arginfo_weechat_plugin_get_name +#define arginfo_weechat_config_boolean_inherited arginfo_weechat_plugin_get_name + #define arginfo_weechat_config_integer arginfo_weechat_plugin_get_name #define arginfo_weechat_config_integer_default arginfo_weechat_plugin_get_name +#define arginfo_weechat_config_integer_inherited arginfo_weechat_plugin_get_name + #define arginfo_weechat_config_string arginfo_weechat_plugin_get_name #define arginfo_weechat_config_string_default arginfo_weechat_plugin_get_name +#define arginfo_weechat_config_string_inherited arginfo_weechat_plugin_get_name + #define arginfo_weechat_config_color arginfo_weechat_plugin_get_name #define arginfo_weechat_config_color_default arginfo_weechat_plugin_get_name +#define arginfo_weechat_config_color_inherited arginfo_weechat_plugin_get_name + #define arginfo_weechat_config_enum arginfo_weechat_plugin_get_name #define arginfo_weechat_config_enum_default arginfo_weechat_plugin_get_name +#define arginfo_weechat_config_enum_inherited arginfo_weechat_plugin_get_name + #define arginfo_weechat_config_write_option arginfo_weechat_iconv_to_internal #define arginfo_weechat_config_write_line arginfo_weechat_ngettext -- cgit v1.2.3