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

trigger: add hook "info_hashtable"

This commit is contained in:
Sébastien Helleu
2019-04-13 13:53:16 +02:00
parent 8bc06ea101
commit 30768d4d24
31 changed files with 574 additions and 314 deletions
+25 -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", "info" };
"timer", "config", "focus", "info", "info_hashtable" };
char *trigger_hook_option_values =
"signal|hsignal|modifier|line|print|command|command_run|timer|config|"
"focus|info";
"focus|info|info_hashtable";
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", "xxx" };
"/cmd", "60000;0;0", "xxx", "chat", "xxx", "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_info" };
"tg_command", "tg_remaining_calls", "tg_value", "", "tg_info", "" };
char *trigger_return_code_string[TRIGGER_NUM_RETURN_CODES] =
{ "ok", "ok_eat", "error" };
@@ -509,6 +509,26 @@ trigger_hook (struct t_trigger *trigger)
}
}
break;
case TRIGGER_HOOK_INFO_HASHTABLE:
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_hashtable (
argv[i],
NULL,
NULL,
NULL,
&trigger_callback_info_hashtable_cb,
trigger, NULL);
}
}
}
break;
}
if (!trigger->hooks)