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

Add new options for completion, optional stop instead of cycling with words found

This commit is contained in:
Sebastien Helleu
2008-06-18 16:47:09 +02:00
parent 47c9c68b40
commit 66e8d703bd
38 changed files with 1190 additions and 517 deletions
+41 -4
View File
@@ -2398,9 +2398,9 @@ static XS (XS_weechat_hook_config)
*/
int
weechat_perl_api_hook_completion_cb (void *data, const char *completion,
weechat_perl_api_hook_completion_cb (void *data, const char *completion_item,
struct t_gui_buffer *buffer,
struct t_weelist *list)
struct t_gui_completion *completion)
{
struct t_script_callback *script_callback;
char *perl_argv[4];
@@ -2408,9 +2408,9 @@ weechat_perl_api_hook_completion_cb (void *data, const char *completion,
script_callback = (struct t_script_callback *)data;
perl_argv[0] = (char *)completion;
perl_argv[0] = (char *)completion_item;
perl_argv[1] = script_ptr2str (buffer);
perl_argv[2] = script_ptr2str (list);
perl_argv[2] = script_ptr2str (completion);
perl_argv[3] = NULL;
rc = (int *) weechat_perl_exec (script_callback->script,
@@ -2468,6 +2468,42 @@ static XS (XS_weechat_hook_completion)
PERL_RETURN_STRING_FREE(result);
}
/*
* weechat::hook_completion_list_add: add a word to list for a completion
*/
static XS (XS_weechat_hook_completion_list_add)
{
char *completion, *word, *where;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("hook_completion_list_add");
PERL_RETURN_ERROR;
}
if (items < 4)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("hook_completion_list_add");
PERL_RETURN_ERROR;
}
completion = SvPV (ST (0), PL_na);
word = SvPV (ST (1), PL_na);
where = SvPV (ST (3), PL_na);
weechat_hook_completion_list_add (script_str2ptr (completion),
word,
SvIV (ST (2)), /* nick_completion */
where);
PERL_RETURN_OK;
}
/*
* weechat_perl_api_hook_modifier_cb: callback for modifier hooked
*/
@@ -3922,6 +3958,7 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::hook_signal_send", XS_weechat_hook_signal_send, "weechat");
newXS ("weechat::hook_config", XS_weechat_hook_config, "weechat");
newXS ("weechat::hook_completion", XS_weechat_hook_completion, "weechat");
newXS ("weechat::hook_completion_list_add", XS_weechat_hook_completion_list_add, "weechat");
newXS ("weechat::hook_modifier", XS_weechat_hook_modifier, "weechat");
newXS ("weechat::hook_modifier_exec", XS_weechat_hook_modifier_exec, "weechat");
newXS ("weechat::unhook", XS_weechat_unhook, "weechat");
+4 -4
View File
@@ -554,16 +554,16 @@ weechat_perl_command_cb (void *data, struct t_gui_buffer *buffer,
*/
int
weechat_perl_completion_cb (void *data, const char *completion,
weechat_perl_completion_cb (void *data, const char *completion_item,
struct t_gui_buffer *buffer,
struct t_weelist *list)
struct t_gui_completion *completion)
{
/* make C compiler happy */
(void) data;
(void) completion;
(void) completion_item;
(void) buffer;
script_completion (weechat_perl_plugin, list, perl_scripts);
script_completion (weechat_perl_plugin, completion, perl_scripts);
return WEECHAT_RC_OK;
}