aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/regexp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-24 17:54:30 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-24 17:54:30 +0000
commitf4e9928ae179eafc13ee564682e9946a24691b7d (patch)
tree180225e1ccc762464892f2cf429c2dfc5770ddd0 /src/plugins/regexp.c
parent6c6de2946b70a4f460533ded4233013a0b1b1557 (diff)
downloadrspamd-f4e9928ae179eafc13ee564682e9946a24691b7d.tar.gz
rspamd-f4e9928ae179eafc13ee564682e9946a24691b7d.zip
Rework system of symbols registration
It is possible now to use priorities when adding symbols to metrics and override scores for symbols with lower priority with the scores with high priority.
Diffstat (limited to 'src/plugins/regexp.c')
-rw-r--r--src/plugins/regexp.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c
index 6458e1577..d80b11f1f 100644
--- a/src/plugins/regexp.c
+++ b/src/plugins/regexp.c
@@ -184,7 +184,8 @@ regexp_module_config (struct rspamd_config *cfg)
const gchar *description = NULL, *group = NULL,
*metric = DEFAULT_METRIC;
gdouble score = 0.0;
- gboolean one_shot = FALSE, is_lua = FALSE, valid_expression = TRUE;
+ guint flags = 0, priority = 0;
+ gboolean is_lua = FALSE, valid_expression = TRUE;
/* We have some lua table, extract its arguments */
elt = ucl_object_lookup (value, "callback");
@@ -269,11 +270,19 @@ regexp_module_config (struct rspamd_config *cfg)
elt = ucl_object_lookup (value, "one_shot");
if (elt) {
- one_shot = ucl_object_toboolean (elt);
+ if (ucl_object_toboolean (elt)) {
+ flags |= RSPAMD_SYMBOL_FLAG_ONESHOT;
+ }
+ }
+
+ elt = ucl_object_lookup (value, "priority");
+
+ if (elt) {
+ priority = ucl_object_toint (elt);
}
rspamd_config_add_metric_symbol (cfg, metric, cur_item->symbol,
- score, description, group, one_shot, FALSE);
+ score, description, group, flags, priority);
}
}
else {