diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2020-08-22 08:55:16 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2020-08-22 08:55:16 +0200 |
commit | 268aa631c6b464c0d97dce5dbe76f145a6cc5f68 (patch) | |
tree | 00ef2b36db0fc64e2723442f1750934aec030901 /src/plugins/php | |
parent | 7dd5abd6252d108858f31a717a127f86d5c206c1 (diff) | |
download | weechat-268aa631c6b464c0d97dce5dbe76f145a6cc5f68.zip |
api: add function string_color_code_size (issue #1547)
Diffstat (limited to 'src/plugins/php')
-rw-r--r-- | src/plugins/php/weechat-php-api.c | 17 | ||||
-rw-r--r-- | src/plugins/php/weechat-php-api.h | 1 | ||||
-rw-r--r-- | src/plugins/php/weechat-php.c | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/plugins/php/weechat-php-api.c b/src/plugins/php/weechat-php-api.c index 6b05825c4..8d5e4bc34 100644 --- a/src/plugins/php/weechat-php-api.c +++ b/src/plugins/php/weechat-php-api.c @@ -497,6 +497,23 @@ API_FUNC(string_format_size) API_RETURN_STRING_FREE(result); } +API_FUNC(string_color_code_size) +{ + zend_string *z_string; + char *string; + int result; + + API_INIT_FUNC(1, "string_color_code_size", API_RETURN_INT(0)); + if (zend_parse_parameters (ZEND_NUM_ARGS(), "S", &z_string) == FAILURE) + API_WRONG_ARGS(API_RETURN_INT(0)); + + string = ZSTR_VAL(z_string); + + result = weechat_string_color_code_size ((const char *)string); + + API_RETURN_INT(result); +} + API_FUNC(string_remove_color) { zend_string *z_string, *z_replacement; diff --git a/src/plugins/php/weechat-php-api.h b/src/plugins/php/weechat-php-api.h index 71ca67b26..65ce9d356 100644 --- a/src/plugins/php/weechat-php-api.h +++ b/src/plugins/php/weechat-php-api.h @@ -59,6 +59,7 @@ PHP_FUNCTION(weechat_string_has_highlight); PHP_FUNCTION(weechat_string_has_highlight_regex); PHP_FUNCTION(weechat_string_mask_to_regex); PHP_FUNCTION(weechat_string_format_size); +PHP_FUNCTION(weechat_string_color_code_size); PHP_FUNCTION(weechat_string_remove_color); PHP_FUNCTION(weechat_string_is_command_char); PHP_FUNCTION(weechat_string_input_for_buffer); diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c index 93a1f2069..ace023828 100644 --- a/src/plugins/php/weechat-php.c +++ b/src/plugins/php/weechat-php.c @@ -112,6 +112,7 @@ const zend_function_entry weechat_functions[] = { PHP_FE(weechat_string_has_highlight_regex, NULL) PHP_FE(weechat_string_mask_to_regex, NULL) PHP_FE(weechat_string_format_size, NULL) + PHP_FE(weechat_string_color_code_size, NULL) PHP_FE(weechat_string_remove_color, NULL) PHP_FE(weechat_string_is_command_char, NULL) PHP_FE(weechat_string_input_for_buffer, NULL) |