From: Vsevolod Stakhov Date: Sun, 28 Feb 2016 11:11:37 +0000 (+0000) Subject: [Feature] Rework dynamic symbols for new metrics API X-Git-Tag: 1.2.0~152 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=512d64b8f33e09908a574b48fcce4c06bb97e4bd;p=thirdparty%2Frspamd.git [Feature] Rework dynamic symbols for new metrics API --- diff --git a/src/libserver/dynamic_cfg.c b/src/libserver/dynamic_cfg.c index 9c8ffe9a78..041438698c 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 (