summaryrefslogtreecommitdiffstats
path: root/src/libserver/cfg_rcl.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-10-09 00:54:39 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-10-09 00:54:39 +0100
commitf1979c2e4d51a0114b0716203090171d6c92b82c (patch)
treee82f13469de16883bcdfa926f1822ef73a4cc080 /src/libserver/cfg_rcl.c
parent4c520213d8f7aa1535fc2b8c8f64cd82a72794c4 (diff)
downloadrspamd-f1979c2e4d51a0114b0716203090171d6c92b82c.tar.gz
rspamd-f1979c2e4d51a0114b0716203090171d6c92b82c.zip
Add `one_shot` attr to metric symbols.
Diffstat (limited to 'src/libserver/cfg_rcl.c')
-rw-r--r--src/libserver/cfg_rcl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 955103883..750b70087 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -255,6 +255,7 @@ rspamd_rcl_insert_symbol (struct rspamd_config *cfg, struct metric *metric,
struct rspamd_symbols_group *sym_group;
struct rspamd_symbol_def *sym_def;
GList *metric_list, *group_list;
+ gboolean one_shot = FALSE;
/*
* We allow two type of definitions:
@@ -264,6 +265,7 @@ rspamd_rcl_insert_symbol (struct rspamd_config *cfg, struct metric *metric,
* weight = ...;
* description = ...;
* group = ...;
+ * one_shot = true/false;
* }
*/
if (is_legacy) {
@@ -298,6 +300,10 @@ rspamd_rcl_insert_symbol (struct rspamd_config *cfg, struct metric *metric,
if (val != NULL) {
ucl_object_tostring_safe (val, &group);
}
+ val = ucl_object_find_key (obj, "one_shot");
+ if (val != NULL) {
+ one_shot = ucl_object_toboolean (val);
+ }
}
else {
g_set_error (err,
@@ -316,8 +322,9 @@ rspamd_rcl_insert_symbol (struct rspamd_config *cfg, struct metric *metric,
sym_def->weight_ptr = score_ptr;
sym_def->name = rspamd_mempool_strdup (cfg->cfg_pool, sym_name);
sym_def->description = (gchar *)description;
+ sym_def->one_shot = one_shot;
- g_hash_table_insert (metric->symbols, sym_def->name, score_ptr);
+ g_hash_table_insert (metric->symbols, sym_def->name, sym_def);
if ((metric_list =
g_hash_table_lookup (cfg->metrics_symbols, sym_def->name)) == NULL) {