aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-28 11:11:37 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-28 11:57:56 +0000
commit512d64b8f33e09908a574b48fcce4c06bb97e4bd (patch)
treebb43790e39eb1a8c174238a2ef8293a8b1896cb7
parent2a1598dbb6342ab583decde78553125c7f50a154 (diff)
downloadrspamd-512d64b8f33e09908a574b48fcce4c06bb97e4bd.tar.gz
rspamd-512d64b8f33e09908a574b48fcce4c06bb97e4bd.zip
[Feature] Rework dynamic symbols for new metrics API
-rw-r--r--src/libserver/dynamic_cfg.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/libserver/dynamic_cfg.c b/src/libserver/dynamic_cfg.c
index 9c8ffe9a7..041438698 100644
--- a/src/libserver/dynamic_cfg.c
+++ b/src/libserver/dynamic_cfg.c
@@ -38,7 +38,7 @@ apply_dynamic_conf (const ucl_object_t *top, struct rspamd_config *cfg)
ucl_object_iter_t it = NULL;
struct metric *real_metric;
struct metric_action *cur_action;
- struct rspamd_symbol_def *s;
+ gdouble nscore;
while ((cur_elt = ucl_object_iterate (top, &it, true))) {
if (ucl_object_type (cur_elt) != UCL_OBJECT) {
@@ -72,10 +72,14 @@ apply_dynamic_conf (const ucl_object_t *top, struct rspamd_config *cfg)
const ucl_object_t *v =
ucl_object_lookup (it_val, "value");
- if((s = g_hash_table_lookup (real_metric->symbols,
- ucl_object_tostring (n))) != NULL) {
- *s->weight_ptr = ucl_object_todouble (v);
- }
+ nscore = ucl_object_todouble (v);
+
+ /*
+ * We use priority = 3 here
+ */
+ rspamd_config_add_metric_symbol (cfg, real_metric->name,
+ ucl_object_tostring (n), nscore, NULL, NULL,
+ 0, 3);
}
else {
msg_info (