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

trigger: split trigger command on creation, not when executing the callback

This commit is contained in:
Sebastien Helleu
2014-02-06 19:26:39 +01:00
parent 4a9c9a0b07
commit 717d89a1f7
4 changed files with 85 additions and 20 deletions
+20 -1
View File
@@ -124,6 +124,25 @@ trigger_config_change_regex (void *data, struct t_config_option *option)
trigger_set_regex (ptr_trigger);
}
/*
* Callback called when trigger option "command" is changed.
*/
void
trigger_config_change_command (void *data, struct t_config_option *option)
{
struct t_trigger *ptr_trigger;
/* make C compiler happy */
(void) data;
ptr_trigger = trigger_search_with_option (option);
if (!ptr_trigger)
return;
trigger_set_commands (ptr_trigger);
}
/*
* Creates an option for a trigger.
*
@@ -212,7 +231,7 @@ trigger_config_create_option (const char *trigger_name, int index_option,
option_name, "string",
N_("command run if conditions are OK, after regex replacements"),
NULL, 0, 0, value, NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
NULL, NULL, &trigger_config_change_command, NULL, NULL, NULL);
break;
case TRIGGER_OPTION_RETURN_CODE:
ptr_option = weechat_config_new_option (