mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 23:36:37 +02:00
api: add function buffer_new_props (closes #1759)
This commit is contained in:
@@ -3332,6 +3332,50 @@ API_FUNC(buffer_new)
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(buffer_new_props)
|
||||
{
|
||||
zend_string *z_name, *z_data_input, *z_data_close;
|
||||
zval *z_properties, *z_input_callback, *z_close_callback;
|
||||
char *name, *data_input, *data_close;
|
||||
struct t_hashtable *properties;
|
||||
const char *result;
|
||||
|
||||
API_INIT_FUNC(1, "buffer_new_props", API_RETURN_EMPTY);
|
||||
if (zend_parse_parameters (ZEND_NUM_ARGS(), "SazSzS", &z_name,
|
||||
&z_properties, &z_input_callback, &z_data_input,
|
||||
&z_close_callback, &z_data_close) == FAILURE)
|
||||
API_WRONG_ARGS(API_RETURN_EMPTY);
|
||||
|
||||
name = ZSTR_VAL(z_name);
|
||||
properties = weechat_php_array_to_hashtable (
|
||||
z_properties,
|
||||
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
WEECHAT_HASHTABLE_STRING);
|
||||
weechat_php_get_function_name (z_input_callback, input_callback_name);
|
||||
data_input = ZSTR_VAL(z_data_input);
|
||||
weechat_php_get_function_name (z_close_callback, close_callback_name);
|
||||
data_close = ZSTR_VAL(z_data_close);
|
||||
|
||||
result = API_PTR2STR(
|
||||
plugin_script_api_buffer_new_props (
|
||||
weechat_php_plugin,
|
||||
php_current_script,
|
||||
(const char *)name,
|
||||
properties,
|
||||
&weechat_php_api_buffer_input_data_cb,
|
||||
(const char *)input_callback_name,
|
||||
(const char *)data_input,
|
||||
&weechat_php_api_buffer_close_cb,
|
||||
(const char *)close_callback_name,
|
||||
(const char *)data_close));
|
||||
|
||||
if (properties)
|
||||
weechat_hashtable_free (properties);
|
||||
|
||||
API_RETURN_STRING(result);
|
||||
}
|
||||
|
||||
API_FUNC(buffer_search)
|
||||
{
|
||||
zend_string *z_plugin, *z_name;
|
||||
|
||||
@@ -155,6 +155,7 @@ PHP_FUNCTION(weechat_hook_set);
|
||||
PHP_FUNCTION(weechat_unhook);
|
||||
PHP_FUNCTION(weechat_unhook_all);
|
||||
PHP_FUNCTION(weechat_buffer_new);
|
||||
PHP_FUNCTION(weechat_buffer_new_props);
|
||||
PHP_FUNCTION(weechat_buffer_search);
|
||||
PHP_FUNCTION(weechat_buffer_search_main);
|
||||
PHP_FUNCTION(weechat_current_buffer);
|
||||
|
||||
@@ -213,6 +213,7 @@ const zend_function_entry weechat_functions[] = {
|
||||
PHP_FE(weechat_unhook, arginfo_weechat_unhook)
|
||||
PHP_FE(weechat_unhook_all, arginfo_weechat_unhook_all)
|
||||
PHP_FE(weechat_buffer_new, arginfo_weechat_buffer_new)
|
||||
PHP_FE(weechat_buffer_new_props, arginfo_weechat_buffer_new_props)
|
||||
PHP_FE(weechat_buffer_search, arginfo_weechat_buffer_search)
|
||||
PHP_FE(weechat_buffer_search_main, arginfo_weechat_buffer_search_main)
|
||||
PHP_FE(weechat_current_buffer, arginfo_weechat_current_buffer)
|
||||
|
||||
@@ -116,6 +116,7 @@ function weechat_hook_set(): mixed {}
|
||||
function weechat_unhook(): mixed {}
|
||||
function weechat_unhook_all(): mixed {}
|
||||
function weechat_buffer_new(): mixed {}
|
||||
function weechat_buffer_new_props(): mixed {}
|
||||
function weechat_buffer_search(): mixed {}
|
||||
function weechat_buffer_search_main(): mixed {}
|
||||
function weechat_current_buffer(): mixed {}
|
||||
|
||||
@@ -222,6 +222,8 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_weechat_buffer_new arginfo_weechat_register
|
||||
|
||||
#define arginfo_weechat_buffer_new_props arginfo_weechat_register
|
||||
|
||||
#define arginfo_weechat_buffer_search arginfo_weechat_register
|
||||
|
||||
#define arginfo_weechat_buffer_search_main arginfo_weechat_register
|
||||
|
||||
@@ -222,6 +222,8 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_weechat_buffer_new arginfo_weechat_register
|
||||
|
||||
#define arginfo_weechat_buffer_new_props arginfo_weechat_register
|
||||
|
||||
#define arginfo_weechat_buffer_search arginfo_weechat_register
|
||||
|
||||
#define arginfo_weechat_buffer_search_main arginfo_weechat_register
|
||||
|
||||
Reference in New Issue
Block a user