mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 22:06:38 +02:00
trigger: evaluate regex replacement on execution of trigger (and not when creating the trigger)
This commit is contained in:
@@ -466,8 +466,6 @@ trigger_free_regex (int *regex_count, struct t_trigger_regex **regex)
|
||||
}
|
||||
if ((*regex)[i].replace)
|
||||
free ((*regex)[i].replace);
|
||||
if ((*regex)[i].replace_eval)
|
||||
free ((*regex)[i].replace_eval);
|
||||
}
|
||||
free (*regex);
|
||||
*regex = NULL;
|
||||
@@ -556,7 +554,6 @@ trigger_split_regex (const char *trigger_name, const char *str_regex,
|
||||
(*regex)[index].str_regex = NULL;
|
||||
(*regex)[index].regex = NULL;
|
||||
(*regex)[index].replace = NULL;
|
||||
(*regex)[index].replace_eval = NULL;
|
||||
|
||||
/* set string with regex */
|
||||
(*regex)[index].str_regex = weechat_strndup (ptr_regex,
|
||||
@@ -588,11 +585,6 @@ trigger_split_regex (const char *trigger_name, const char *str_regex,
|
||||
strdup (pos_replace + length_delimiter);
|
||||
if (!(*regex)[index].replace)
|
||||
goto memory_error;
|
||||
(*regex)[index].replace_eval =
|
||||
weechat_string_eval_expression ((*regex)[index].replace,
|
||||
NULL, NULL, NULL);
|
||||
if (!(*regex)[index].replace_eval)
|
||||
goto memory_error;
|
||||
|
||||
if (!pos_replace_end)
|
||||
break;
|
||||
@@ -1077,8 +1069,6 @@ trigger_print_log ()
|
||||
i, ptr_trigger->regex[i].regex);
|
||||
weechat_log_printf (" regex[%03d].replace. . . : '%s'",
|
||||
i, ptr_trigger->regex[i].replace);
|
||||
weechat_log_printf (" regex[%03d].replace_eval : '%s'",
|
||||
i, ptr_trigger->regex[i].replace_eval);
|
||||
}
|
||||
weechat_log_printf (" commands_count. . . . . : %d", ptr_trigger->commands_count);
|
||||
weechat_log_printf (" commands. . . . . . . . : 0x%lx", ptr_trigger->commands);
|
||||
|
||||
Reference in New Issue
Block a user