1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 16:23:14 +02:00

api: add missing function hook_completion_get_string() in script API (issue #484)

This commit is contained in:
Sébastien Helleu
2015-08-13 20:45:33 +02:00
parent 6b75516702
commit 7033fdd0cb
8 changed files with 137 additions and 0 deletions
+2
View File
@@ -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
+17
View File
@@ -2721,6 +2721,22 @@ weechat_guile_api_hook_completion (SCM completion, SCM description,
API_RETURN_STRING_FREE(result);
}
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);
+17
View File
@@ -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);
+18
View File
@@ -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),
+20
View File
@@ -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);
+18
View File
@@ -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),
+24
View File
@@ -3330,6 +3330,29 @@ weechat_ruby_api_hook_completion (VALUE class, VALUE completion,
API_RETURN_STRING_FREE(result);
}
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,
@@ -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);
+21
View File
@@ -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);