summaryrefslogtreecommitdiff
path: root/src/plugins/perl
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-03-12 10:39:34 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-03-13 10:35:29 +0100
commite5e3a9d2da382c7260b305e823a693734189a338 (patch)
tree50a888febc6c50ea22154982e5a8484d38eac746 /src/plugins/perl
parentfbbed9fbf7262ad497a012e40f9e6e3d39dd6030 (diff)
downloadweechat-e5e3a9d2da382c7260b305e823a693734189a338.zip
api: add function buffer_new_props (closes #1759)
Diffstat (limited to 'src/plugins/perl')
-rw-r--r--src/plugins/perl/weechat-perl-api.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c
index 27438b3ee..791c276ce 100644
--- a/src/plugins/perl/weechat-perl-api.c
+++ b/src/plugins/perl/weechat-perl-api.c
@@ -3412,6 +3412,46 @@ API_FUNC(buffer_new)
API_RETURN_STRING(result);
}
+API_FUNC(buffer_new_props)
+{
+ char *name, *function_input, *data_input, *function_close, *data_close;
+ struct t_hashtable *properties;
+ const char *result;
+ dXSARGS;
+
+ API_INIT_FUNC(1, "buffer_new_props", API_RETURN_EMPTY);
+ if (items < 6)
+ API_WRONG_ARGS(API_RETURN_EMPTY);
+
+ name = SvPV_nolen (ST (0));
+ properties = weechat_perl_hash_to_hashtable (ST (1),
+ WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING);
+ function_input = SvPV_nolen (ST (2));
+ data_input = SvPV_nolen (ST (3));
+ function_close = SvPV_nolen (ST (4));
+ data_close = SvPV_nolen (ST (5));
+
+ result = API_PTR2STR(
+ plugin_script_api_buffer_new_props (
+ weechat_perl_plugin,
+ perl_current_script,
+ name,
+ properties,
+ &weechat_perl_api_buffer_input_data_cb,
+ function_input,
+ data_input,
+ &weechat_perl_api_buffer_close_cb,
+ function_close,
+ data_close));
+
+ if (properties)
+ weechat_hashtable_free (properties);
+
+ API_RETURN_STRING(result);
+}
+
API_FUNC(buffer_search)
{
char *plugin, *name;
@@ -5423,6 +5463,7 @@ weechat_perl_api_init (pTHX)
API_DEF_FUNC(unhook);
API_DEF_FUNC(unhook_all);
API_DEF_FUNC(buffer_new);
+ API_DEF_FUNC(buffer_new_props);
API_DEF_FUNC(buffer_search);
API_DEF_FUNC(buffer_search_main);
API_DEF_FUNC(current_buffer);