summaryrefslogtreecommitdiff
path: root/src/plugins/php
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-09-09 08:54:33 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-09-09 08:54:33 +0200
commitd9555cc5679eebbfa8d5d03c34a6f63e516c7a04 (patch)
treee647dfb2e0acbd1f1c493de96ed25550a0d2b9a1 /src/plugins/php
parent9fada89f96f7b702b8d4c9927badb7155a0c8adf (diff)
downloadweechat-d9555cc5679eebbfa8d5d03c34a6f63e516c7a04.zip
scripts: add functions config_enum and config_enum_default in scripting API (issue #1973)
Diffstat (limited to 'src/plugins/php')
-rw-r--r--src/plugins/php/weechat-php-api.c34
-rw-r--r--src/plugins/php/weechat-php-api.h2
-rw-r--r--src/plugins/php/weechat-php.c2
-rw-r--r--src/plugins/php/weechat-php.stub.php2
-rw-r--r--src/plugins/php/weechat-php_arginfo.h6
-rw-r--r--src/plugins/php/weechat-php_legacy_arginfo.h6
6 files changed, 50 insertions, 2 deletions
diff --git a/src/plugins/php/weechat-php-api.c b/src/plugins/php/weechat-php-api.c
index 7b1b918f8..32835d23c 100644
--- a/src/plugins/php/weechat-php-api.c
+++ b/src/plugins/php/weechat-php-api.c
@@ -1740,6 +1740,40 @@ API_FUNC(config_color_default)
API_RETURN_STRING(result);
}
+API_FUNC(config_enum)
+{
+ zend_string *z_option;
+ struct t_config_option *option;
+ int result;
+
+ API_INIT_FUNC(1, "config_enum", 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 (option);
+
+ API_RETURN_INT(result);
+}
+
+API_FUNC(config_enum_default)
+{
+ zend_string *z_option;
+ struct t_config_option *option;
+ int result;
+
+ API_INIT_FUNC(1, "config_enum_default", 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_default (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 8b1d9b1a4..348ac94da 100644
--- a/src/plugins/php/weechat-php-api.h
+++ b/src/plugins/php/weechat-php-api.h
@@ -106,6 +106,8 @@ PHP_FUNCTION(weechat_config_string);
PHP_FUNCTION(weechat_config_string_default);
PHP_FUNCTION(weechat_config_color);
PHP_FUNCTION(weechat_config_color_default);
+PHP_FUNCTION(weechat_config_enum);
+PHP_FUNCTION(weechat_config_enum_default);
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 747768b51..ae7293528 100644
--- a/src/plugins/php/weechat-php.c
+++ b/src/plugins/php/weechat-php.c
@@ -164,6 +164,8 @@ const zend_function_entry weechat_functions[] = {
PHP_FE(weechat_config_string_default, arginfo_weechat_config_string_default)
PHP_FE(weechat_config_color, arginfo_weechat_config_color)
PHP_FE(weechat_config_color_default, arginfo_weechat_config_color_default)
+ PHP_FE(weechat_config_enum, arginfo_weechat_config_enum)
+ PHP_FE(weechat_config_enum_default, arginfo_weechat_config_enum_default)
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 a82e6aa27..b9297f8aa 100644
--- a/src/plugins/php/weechat-php.stub.php
+++ b/src/plugins/php/weechat-php.stub.php
@@ -72,6 +72,8 @@ function weechat_config_string(string $p0): string {}
function weechat_config_string_default(string $p0): string {}
function weechat_config_color(string $p0): string {}
function weechat_config_color_default(string $p0): string {}
+function weechat_config_enum(string $p0): int {}
+function weechat_config_enum_default(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 cfdb257a3..df6d3a5bf 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: 5c460494eac0e2ed6729ab210df6679f990070d6 */
+ * Stub hash: d9a98a051023d3904f6e6f94b776386b3b67a5f6 */
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)
@@ -181,6 +181,10 @@ ZEND_END_ARG_INFO()
#define arginfo_weechat_config_color_default 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_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 24993b583..951f9f11a 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: 5c460494eac0e2ed6729ab210df6679f990070d6 */
+ * Stub hash: d9a98a051023d3904f6e6f94b776386b3b67a5f6 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_weechat_register, 0, 0, 7)
ZEND_ARG_INFO(0, p0)
@@ -146,6 +146,10 @@ ZEND_END_ARG_INFO()
#define arginfo_weechat_config_color_default 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_write_option arginfo_weechat_iconv_to_internal
#define arginfo_weechat_config_write_line arginfo_weechat_ngettext