diff options
-rw-r--r-- | ChangeLog.asciidoc | 2 | ||||
-rw-r--r-- | src/plugins/guile/weechat-guile-api.c | 17 | ||||
-rw-r--r-- | src/plugins/javascript/weechat-js-api.cpp | 17 | ||||
-rw-r--r-- | src/plugins/lua/weechat-lua-api.c | 18 | ||||
-rw-r--r-- | src/plugins/perl/weechat-perl-api.c | 20 | ||||
-rw-r--r-- | src/plugins/python/weechat-python-api.c | 18 | ||||
-rw-r--r-- | src/plugins/ruby/weechat-ruby-api.c | 24 | ||||
-rw-r--r-- | src/plugins/tcl/weechat-tcl-api.c | 21 |
8 files changed, 137 insertions, 0 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 1111ed45d..9a602992b 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -58,6 +58,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * core: fix bar item "scroll" after /buffer clear (issue #448) * core: fix display of time in bare display when option weechat.look.buffer_time_format is set to empty string (issue #441) +* api: add missing function hook_completion_get_string() in script API + (issue #484) * api: fix type of value returned by functions strcasestr, utf8_prev_char, utf8_next_char, utf8_add_offset and util_get_time_string * api: fix type of value returned by function strcasestr diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index 14bc1cfa4..7f5962837 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -2722,6 +2722,22 @@ weechat_guile_api_hook_completion (SCM completion, SCM description, } SCM +weechat_guile_api_hook_completion_get_string (SCM completion, SCM property) +{ + const char *result; + + API_INIT_FUNC(1, "hook_completion_get_string", API_RETURN_EMPTY); + if (!scm_is_string (completion) || !scm_is_string (property)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result = weechat_hook_completion_get_string ( + API_STR2PTR(API_SCM_TO_STRING(completion)), + API_SCM_TO_STRING(property)); + + API_RETURN_STRING(result); +} + +SCM weechat_guile_api_hook_completion_list_add (SCM completion, SCM word, SCM nick_completion, SCM where) { @@ -4780,6 +4796,7 @@ weechat_guile_api_module_init (void *data) API_DEF_FUNC(hook_hsignal_send, 2); API_DEF_FUNC(hook_config, 3); API_DEF_FUNC(hook_completion, 4); + API_DEF_FUNC(hook_completion_get_string, 2); API_DEF_FUNC(hook_completion_list_add, 4); API_DEF_FUNC(hook_modifier, 3); API_DEF_FUNC(hook_modifier_exec, 3); diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp index 409a0fc34..b3c959d5c 100644 --- a/src/plugins/javascript/weechat-js-api.cpp +++ b/src/plugins/javascript/weechat-js-api.cpp @@ -2665,6 +2665,22 @@ API_FUNC(hook_completion) API_RETURN_STRING_FREE(result); } +API_FUNC(hook_completion_get_string) +{ + const char *result; + + API_INIT_FUNC(1, "hook_completion_get_string", "ss", API_RETURN_EMPTY); + + v8::String::Utf8Value completion(args[0]); + v8::String::Utf8Value property(args[1]); + + result = weechat_hook_completion_get_string ( + (struct t_gui_completion *)API_STR2PTR(*completion), + *property); + + API_RETURN_STRING(result); +} + API_FUNC(hook_completion_list_add) { int nick_completion; @@ -4792,6 +4808,7 @@ WeechatJsV8::loadLibs() API_DEF_FUNC(hook_hsignal_send); API_DEF_FUNC(hook_config); API_DEF_FUNC(hook_completion); + API_DEF_FUNC(hook_completion_get_string); API_DEF_FUNC(hook_completion_list_add); API_DEF_FUNC(hook_modifier); API_DEF_FUNC(hook_modifier_exec); diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index 2b3270a92..55cc1771a 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -2837,6 +2837,23 @@ API_FUNC(hook_completion) API_RETURN_STRING_FREE(result); } +API_FUNC(hook_completion_get_string) +{ + const char *completion, *property, *result; + + API_INIT_FUNC(1, "hook_completion_get_string", API_RETURN_EMPTY); + if (lua_gettop (L) < 2) + API_WRONG_ARGS(API_RETURN_EMPTY); + + completion = lua_tostring (L, -2); + property = lua_tostring (L, -1); + + result = weechat_hook_completion_get_string (API_STR2PTR(completion), + property); + + API_RETURN_STRING(result); +} + API_FUNC(hook_completion_list_add) { const char *completion, *word, *where; @@ -5071,6 +5088,7 @@ const struct luaL_Reg weechat_lua_api_funcs[] = { API_DEF_FUNC(hook_hsignal_send), API_DEF_FUNC(hook_config), API_DEF_FUNC(hook_completion), + API_DEF_FUNC(hook_completion_get_string), API_DEF_FUNC(hook_completion_list_add), API_DEF_FUNC(hook_modifier), API_DEF_FUNC(hook_modifier_exec), diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index dddcb9500..e88d1108a 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -2756,6 +2756,25 @@ API_FUNC(hook_completion) API_RETURN_STRING_FREE(result); } +API_FUNC(hook_completion_get_string) +{ + char *completion, *property; + const char *result; + dXSARGS; + + API_INIT_FUNC(1, "hook_completion_get_string", API_RETURN_EMPTY); + if (items < 2) + API_WRONG_ARGS(API_RETURN_EMPTY); + + completion = SvPV_nolen (ST (0)); + property = SvPV_nolen (ST (1)); + + result = weechat_hook_completion_get_string (API_STR2PTR(completion), + property); + + API_RETURN_STRING(result); +} + API_FUNC(hook_completion_list_add) { char *completion, *word, *where; @@ -5013,6 +5032,7 @@ weechat_perl_api_init (pTHX) API_DEF_FUNC(hook_hsignal_send); API_DEF_FUNC(hook_config); API_DEF_FUNC(hook_completion); + API_DEF_FUNC(hook_completion_get_string); API_DEF_FUNC(hook_completion_list_add); API_DEF_FUNC(hook_modifier); API_DEF_FUNC(hook_modifier_exec); diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index 77f2195df..19958e46b 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -2790,6 +2790,23 @@ API_FUNC(hook_completion) API_RETURN_STRING_FREE(result); } +API_FUNC(hook_completion_get_string) +{ + char *completion, *property; + const char *result; + + API_INIT_FUNC(1, "hook_completion_get_string", API_RETURN_EMPTY); + completion = NULL; + property = NULL; + if (!PyArg_ParseTuple (args, "ss", &completion, &property)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + result = weechat_hook_completion_get_string (API_STR2PTR(completion), + property); + + API_RETURN_STRING(result); +} + API_FUNC(hook_completion_list_add) { char *completion, *word, *where; @@ -4996,6 +5013,7 @@ PyMethodDef weechat_python_funcs[] = API_DEF_FUNC(hook_hsignal_send), API_DEF_FUNC(hook_config), API_DEF_FUNC(hook_completion), + API_DEF_FUNC(hook_completion_get_string), API_DEF_FUNC(hook_completion_list_add), API_DEF_FUNC(hook_modifier), API_DEF_FUNC(hook_modifier_exec), diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index 1cd26074f..03f9df04f 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -3331,6 +3331,29 @@ weechat_ruby_api_hook_completion (VALUE class, VALUE completion, } static VALUE +weechat_ruby_api_hook_completion_get_string (VALUE class, VALUE completion, + VALUE property) +{ + char *c_completion, *c_property; + const char *result; + + API_INIT_FUNC(1, "hook_completion_get_string", API_RETURN_EMPTY); + if (NIL_P (completion) || NIL_P (property)) + API_WRONG_ARGS(API_RETURN_EMPTY); + + Check_Type (completion, T_STRING); + Check_Type (property, T_STRING); + + c_completion = StringValuePtr (completion); + c_property = StringValuePtr (property); + + result = weechat_hook_completion_get_string (API_STR2PTR(c_completion), + c_property); + + API_RETURN_STRING(result); +} + +static VALUE weechat_ruby_api_hook_completion_list_add (VALUE class, VALUE completion, VALUE word, VALUE nick_completion, VALUE where) @@ -6131,6 +6154,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) API_DEF_FUNC(hook_hsignal_send, 2); API_DEF_FUNC(hook_config, 3); API_DEF_FUNC(hook_completion, 4); + API_DEF_FUNC(hook_completion_get_string, 2); API_DEF_FUNC(hook_completion_list_add, 4); API_DEF_FUNC(hook_modifier, 3); API_DEF_FUNC(hook_modifier_exec, 3); diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index 851d423d1..4d1990d8d 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -3031,6 +3031,26 @@ API_FUNC(hook_completion) API_RETURN_STRING_FREE(result); } +API_FUNC(hook_completion_get_string) +{ + Tcl_Obj *objp; + char *completion, *property; + const char *result; + int i; + + API_INIT_FUNC(1, "hook_completion_get_string", API_RETURN_EMPTY); + if (objc < 3) + API_WRONG_ARGS(API_RETURN_EMPTY); + + completion = Tcl_GetStringFromObj (objv[1], &i); + property = Tcl_GetStringFromObj (objv[2], &i); + + result = weechat_hook_completion_get_string (API_STR2PTR(completion), + property); + + API_RETURN_STRING(result); +} + API_FUNC(hook_completion_list_add) { Tcl_Obj *objp; @@ -5474,6 +5494,7 @@ void weechat_tcl_api_init (Tcl_Interp *interp) API_DEF_FUNC(hook_hsignal_send); API_DEF_FUNC(hook_config); API_DEF_FUNC(hook_completion); + API_DEF_FUNC(hook_completion_get_string); API_DEF_FUNC(hook_completion_list_add); API_DEF_FUNC(hook_modifier); API_DEF_FUNC(hook_modifier_exec); |