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

api: add functions config_option_get_string and config_option_get_pointer in scripting API

This commit is contained in:
Sébastien Helleu
2024-03-03 10:32:11 +01:00
parent 0bf560f9b7
commit c3eff15a56
22 changed files with 349 additions and 3 deletions
+42 -1
View File
@@ -1570,6 +1570,47 @@ API_FUNC(config_option_rename)
API_RETURN_OK;
}
API_FUNC(config_option_get_string)
{
zend_string *z_option, *z_property;
struct t_config_option *option;
char *property;
const char *result;
API_INIT_FUNC(1, "config_option_get_string", API_RETURN_EMPTY);
if (zend_parse_parameters (ZEND_NUM_ARGS(), "SS", &z_option,
&z_property) == FAILURE)
API_WRONG_ARGS(API_RETURN_EMPTY);
option = (struct t_config_option *)API_STR2PTR(ZSTR_VAL(z_option));
property = ZSTR_VAL(z_property);
result = weechat_config_option_get_string (option, (const char *)property);
API_RETURN_STRING(result);
}
API_FUNC(config_option_get_pointer)
{
zend_string *z_option, *z_property;
struct t_config_option *option;
char *property;
const char *result;
API_INIT_FUNC(1, "config_option_get_pointer", API_RETURN_EMPTY);
if (zend_parse_parameters (ZEND_NUM_ARGS(), "SS", &z_option,
&z_property) == FAILURE)
API_WRONG_ARGS(API_RETURN_EMPTY);
option = (struct t_config_option *)API_STR2PTR(ZSTR_VAL(z_option));
property = ZSTR_VAL(z_property);
result = API_PTR2STR(
weechat_config_option_get_pointer (option, (const char *)property));
API_RETURN_STRING(result);
}
API_FUNC(config_option_is_null)
{
zend_string *z_option;
@@ -3764,9 +3805,9 @@ API_FUNC(buffer_get_integer)
API_FUNC(buffer_get_string)
{
zend_string *z_buffer, *z_property;
const char *result;
struct t_gui_buffer *buffer;
char *property;
const char *result;
API_INIT_FUNC(1, "buffer_get_string", API_RETURN_EMPTY);
if (zend_parse_parameters (ZEND_NUM_ARGS(), "SS", &z_buffer,
+2
View File
@@ -96,6 +96,8 @@ PHP_FUNCTION(weechat_config_option_set);
PHP_FUNCTION(weechat_config_option_set_null);
PHP_FUNCTION(weechat_config_option_unset);
PHP_FUNCTION(weechat_config_option_rename);
PHP_FUNCTION(weechat_config_option_get_string);
PHP_FUNCTION(weechat_config_option_get_pointer);
PHP_FUNCTION(weechat_config_option_is_null);
PHP_FUNCTION(weechat_config_option_default_is_null);
PHP_FUNCTION(weechat_config_boolean);
+2
View File
@@ -154,6 +154,8 @@ const zend_function_entry weechat_functions[] = {
PHP_FE(weechat_config_option_set_null, arginfo_weechat_config_option_set_null)
PHP_FE(weechat_config_option_unset, arginfo_weechat_config_option_unset)
PHP_FE(weechat_config_option_rename, arginfo_weechat_config_option_rename)
PHP_FE(weechat_config_option_get_string, arginfo_weechat_config_option_get_string)
PHP_FE(weechat_config_option_get_pointer, arginfo_weechat_config_option_get_pointer)
PHP_FE(weechat_config_option_is_null, arginfo_weechat_config_option_is_null)
PHP_FE(weechat_config_option_default_is_null, arginfo_weechat_config_option_default_is_null)
PHP_FE(weechat_config_boolean, arginfo_weechat_config_boolean)
+2
View File
@@ -62,6 +62,8 @@ function weechat_config_option_set(string $p0, string $p1, int $p2): int {}
function weechat_config_option_set_null(string $p0, int $p1): int {}
function weechat_config_option_unset(string $p0): int {}
function weechat_config_option_rename(string $p0, string $p1): int {}
function weechat_config_option_get_string(string $p0, string $p1): string {}
function weechat_config_option_get_pointer(string $p0, string $p1): string {}
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 {}
+6 -1
View File
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: b6e9e3f12ed24566eb77aa0c08bf3e7c5d866b76 */
* Stub hash: 2c52caa5a78009856a6e6ced63555d1b1e2be0fe */
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)
@@ -161,6 +161,10 @@ ZEND_END_ARG_INFO()
#define arginfo_weechat_config_option_rename arginfo_weechat_string_has_highlight
#define arginfo_weechat_config_option_get_string arginfo_weechat_iconv_to_internal
#define arginfo_weechat_config_option_get_pointer arginfo_weechat_iconv_to_internal
#define arginfo_weechat_config_option_is_null arginfo_weechat_charset_set
#define arginfo_weechat_config_option_default_is_null arginfo_weechat_charset_set
@@ -639,3 +643,4 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_forget_class, 0, 1, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
#define arginfo_forget_function arginfo_forget_class
+6 -1
View File
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: b6e9e3f12ed24566eb77aa0c08bf3e7c5d866b76 */
* Stub hash: 2c52caa5a78009856a6e6ced63555d1b1e2be0fe */
ZEND_BEGIN_ARG_INFO_EX(arginfo_weechat_register, 0, 0, 7)
ZEND_ARG_INFO(0, p0)
@@ -126,6 +126,10 @@ ZEND_END_ARG_INFO()
#define arginfo_weechat_config_option_rename arginfo_weechat_iconv_to_internal
#define arginfo_weechat_config_option_get_string arginfo_weechat_iconv_to_internal
#define arginfo_weechat_config_option_get_pointer arginfo_weechat_iconv_to_internal
#define arginfo_weechat_config_option_is_null arginfo_weechat_plugin_get_name
#define arginfo_weechat_config_option_default_is_null arginfo_weechat_plugin_get_name
@@ -462,3 +466,4 @@ ZEND_END_ARG_INFO()
#define arginfo_forget_class arginfo_weechat_plugin_get_name
#define arginfo_forget_function arginfo_weechat_plugin_get_name