mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 15:26:37 +02:00
trigger: add hook focus
This commit is contained in:
@@ -49,19 +49,19 @@ char *trigger_option_default[TRIGGER_NUM_OPTIONS] =
|
||||
|
||||
char *trigger_hook_type_string[TRIGGER_NUM_HOOK_TYPES] =
|
||||
{ "signal", "hsignal", "modifier", "print", "command", "command_run", "timer",
|
||||
"config" };
|
||||
"config", "focus" };
|
||||
char *trigger_hook_option_values =
|
||||
"signal|hsignal|modifier|print|command|command_run|timer|config";
|
||||
"signal|hsignal|modifier|print|command|command_run|timer|config|focus";
|
||||
char *trigger_hook_default_arguments[TRIGGER_NUM_HOOK_TYPES] =
|
||||
{ "xxx", "xxx", "xxx", "", "cmd;desc;args;args_desc;%(buffers_names)", "/cmd",
|
||||
"60000;0;0", "xxx" };
|
||||
"60000;0;0", "xxx", "chat" };
|
||||
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", "tg_message", "tg_argv_eol1", "tg_command",
|
||||
"", "tg_value" };
|
||||
"", "tg_value", "" };
|
||||
|
||||
char *trigger_return_code_string[TRIGGER_NUM_RETURN_CODES] =
|
||||
{ "ok", "ok_eat", "error" };
|
||||
@@ -409,6 +409,23 @@ trigger_hook (struct t_trigger *trigger)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TRIGGER_HOOK_FOCUS:
|
||||
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_focus (
|
||||
argv[i],
|
||||
&trigger_callback_focus_cb,
|
||||
trigger);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!trigger->hooks)
|
||||
|
||||
Reference in New Issue
Block a user