diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2019-02-28 00:14:38 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2019-02-28 20:19:18 +0100 |
commit | 80b980b2af71faa9a2d825c61a5d41d7ace0dc60 (patch) | |
tree | 64056a5a5fb428869b62c6c0309155c67acbc432 /src/plugins/guile | |
parent | 64043d5a6c4ca258c40a8c39d0f58fc4a16c86b9 (diff) | |
download | weechat-80b980b2af71faa9a2d825c61a5d41d7ace0dc60.zip |
api: add function command_options (issue #928)
Diffstat (limited to 'src/plugins/guile')
-rw-r--r-- | src/plugins/guile/weechat-guile-api.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index 29f8fbf78..410eebe49 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -4077,6 +4077,34 @@ weechat_guile_api_command (SCM buffer, SCM command) } SCM +weechat_guile_api_command_options (SCM buffer, SCM command, SCM options) +{ + struct t_hashtable *c_options; + int rc; + + API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR)); + if (!scm_is_string (buffer) || !scm_is_string (command) + || !scm_list_p (options)) + API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR)); + + c_options = weechat_guile_alist_to_hashtable (options, + WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING); + + rc = plugin_script_api_command_options (weechat_guile_plugin, + guile_current_script, + API_STR2PTR(API_SCM_TO_STRING(buffer)), + API_SCM_TO_STRING(command), + c_options); + + if (c_options) + weechat_hashtable_free (c_options); + + API_RETURN_INT(rc); +} + +SCM weechat_guile_api_info_get (SCM info_name, SCM arguments) { const char *result; @@ -5016,6 +5044,7 @@ weechat_guile_api_module_init (void *data) API_DEF_FUNC(bar_update, 1); API_DEF_FUNC(bar_remove, 1); API_DEF_FUNC(command, 2); + API_DEF_FUNC(command_options, 3); API_DEF_FUNC(info_get, 2); API_DEF_FUNC(info_get_hashtable, 2); API_DEF_FUNC(infolist_new, 0); |