1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 20:36:38 +02:00

trigger: add hook "info"

This commit is contained in:
Sébastien Helleu
2019-04-13 08:52:40 +02:00
parent 299c308f00
commit 8bc06ea101
25 changed files with 283 additions and 68 deletions
+24 -5
View File
@@ -50,20 +50,20 @@ char *trigger_option_default[TRIGGER_NUM_OPTIONS] =
char *trigger_hook_type_string[TRIGGER_NUM_HOOK_TYPES] =
{ "signal", "hsignal", "modifier", "line", "print", "command", "command_run",
"timer", "config", "focus" };
"timer", "config", "focus", "info" };
char *trigger_hook_option_values =
"signal|hsignal|modifier|line|print|command|command_run|timer|config|"
"focus";
"focus|info";
char *trigger_hook_default_arguments[TRIGGER_NUM_HOOK_TYPES] =
{ "xxx", "xxx", "xxx", "", "", "cmd;desc;args;args_desc;%(buffers_names)",
"/cmd", "60000;0;0", "xxx", "chat" };
"/cmd", "60000;0;0", "xxx", "chat", "xxx" };
char *trigger_hook_default_rc[TRIGGER_NUM_HOOK_TYPES] =
{ "ok,ok_eat,error", "ok,ok_eat,error", "", "", "ok,error", "ok,error",
"ok,ok_eat,error", "ok", "ok", "" };
"ok,ok_eat,error", "ok", "ok", "", "" };
char *trigger_hook_regex_default_var[TRIGGER_NUM_HOOK_TYPES] =
{ "tg_signal_data", "", "tg_string", "message", "tg_message", "tg_argv_eol1",
"tg_command", "tg_remaining_calls", "tg_value", "" };
"tg_command", "tg_remaining_calls", "tg_value", "", "tg_info" };
char *trigger_return_code_string[TRIGGER_NUM_RETURN_CODES] =
{ "ok", "ok_eat", "error" };
@@ -490,6 +490,25 @@ trigger_hook (struct t_trigger *trigger)
}
}
break;
case TRIGGER_HOOK_INFO:
if (argv && (argc >= 1))
{
trigger->hooks = malloc (argc * sizeof (trigger->hooks[0]));
if (trigger->hooks)
{
trigger->hooks_count = argc;
for (i = 0; i < argc; i++)
{
trigger->hooks[i] = weechat_hook_info (
argv[i],
NULL,
NULL,
&trigger_callback_info_cb,
trigger, NULL);
}
}
}
break;
}
if (!trigger->hooks)