summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2020-07-31 20:50:33 +0200
committerSébastien Helleu <flashcode@flashtux.org>2020-07-31 20:50:33 +0200
commit7412f5815c882120ddfaa2a19d0008aca2c4f502 (patch)
tree39576a59a032fb1638ae28def59e2195cf37abda
parent00e25af4700caf7971bb629b8707407c359d3fbf (diff)
downloadweechat-7412f5815c882120ddfaa2a19d0008aca2c4f502.zip
trigger: fix recursive calls to triggers using regex (closes #1546)
-rw-r--r--ChangeLog.adoc1
-rw-r--r--src/plugins/trigger/trigger-callback.c24
2 files changed, 12 insertions, 13 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 768ea3df9..b6c265308 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -27,6 +27,7 @@ New features::
Bug fixes::
* core: do not add line with highlight and tag "notify_none" to hotlist (issue #1529)
+ * trigger: fix recursive calls to triggers using regex (issue #1546)
* trigger: add `${tg_tags} !!- ,notify_none,` in conditions of default trigger "beep" (issue #1529)
[[v2.9]]
diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c
index 995daa6c1..ada254911 100644
--- a/src/plugins/trigger/trigger-callback.c
+++ b/src/plugins/trigger/trigger-callback.c
@@ -33,9 +33,6 @@
/* hashtable used to evaluate "conditions" */
struct t_hashtable *trigger_callback_hashtable_options_conditions = NULL;
-/* hashtable used to replace with regex */
-struct t_hashtable *trigger_callback_hashtable_options_regex = NULL;
-
/*
* Parses an IRC message.
@@ -233,6 +230,7 @@ trigger_callback_replace_regex (struct t_trigger *trigger,
char *value;
const char *ptr_key, *ptr_value;
int i, pointers_allocated;
+ struct t_hashtable *hashtable_options_regex;
pointers_allocated = 0;
@@ -283,8 +281,14 @@ trigger_callback_replace_regex (struct t_trigger *trigger,
ptr_value = weechat_hashtable_get (extra_vars, ptr_key);
}
+ hashtable_options_regex = weechat_hashtable_new (
+ 32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING,
+ NULL, NULL);
+
weechat_hashtable_set (pointers, "regex", trigger->regex[i].regex);
- weechat_hashtable_set (trigger_callback_hashtable_options_regex,
+ weechat_hashtable_set (hashtable_options_regex,
"regex_replace",
trigger->regex[i].replace_escaped);
@@ -292,7 +296,9 @@ trigger_callback_replace_regex (struct t_trigger *trigger,
ptr_value,
pointers,
extra_vars,
- trigger_callback_hashtable_options_regex);
+ hashtable_options_regex);
+
+ weechat_hashtable_free (hashtable_options_regex);
if (value)
{
@@ -1284,12 +1290,6 @@ trigger_callback_init ()
weechat_hashtable_set (trigger_callback_hashtable_options_conditions,
"type", "condition");
}
-
- trigger_callback_hashtable_options_regex = weechat_hashtable_new (
- 32,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_STRING,
- NULL, NULL);
}
/*
@@ -1301,6 +1301,4 @@ trigger_callback_end ()
{
if (trigger_callback_hashtable_options_conditions)
weechat_hashtable_free (trigger_callback_hashtable_options_conditions);
- if (trigger_callback_hashtable_options_regex)
- weechat_hashtable_free (trigger_callback_hashtable_options_regex);
}