struct rspamd_symbol_option *prev, *next;
};
+enum rspamd_symbol_result_flags {
+ RSPAMD_SYMBOL_RESULT_NORMAL = 0,
+ RSPAMD_SYMBOL_RESULT_IGNORED = (1 << 0)
+};
+
/**
* Rspamd symbol
*/
const gchar *name;
struct rspamd_symbol *sym; /**< symbol configuration */
guint nshots;
+ enum rspamd_symbol_result_flags flags;
};
/**
if (has_valid_op) {
if (want_remove_symbol || want_forced) {
- g_hash_table_remove (cd->metric_res->symbols, key);
+ rd->ms->flags |= RSPAMD_SYMBOL_RESULT_IGNORED;
msg_debug_composites ("remove symbol %s", key);
}
while (g_hash_table_iter_next (&hiter, &h, &v)) {
sym = (struct rspamd_symbol_result *)v;
- sobj = rspamd_metric_symbol_ucl (task, sym);
- ucl_object_insert_key (obj, sobj, h, 0, false);
+ if (!(sym->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) {
+ sobj = rspamd_metric_symbol_ucl (task, sym);
+ ucl_object_insert_key (obj, sobj, h, 0, false);
+ }
}
if (task->cmd == CMD_CHECK_V2) {
struct rspamd_symbol_result *s = value;
guint wr;
+ if (s->flags & RSPAMD_SYMBOL_RESULT_IGNORED) {
+ return;
+ }
+
if (cb->remain > 0) {
wr = rspamd_snprintf (cb->pos, cb->remain, "%s, ", s->name);
cb->pos += wr;
sorted_symbols = g_ptr_array_sized_new (g_hash_table_size (mres->symbols));
while (g_hash_table_iter_next (&it, &k, &v)) {
- g_ptr_array_add (sorted_symbols, v);
+ sym = v;
+
+ if (!(sym->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) {
+ g_ptr_array_add (sorted_symbols, v);
+ }
}
g_ptr_array_sort (sorted_symbols, rspamd_task_compare_log_sym);
while (g_hash_table_iter_next (&it, &k, &v)) {
s = v;
- lua_pushstring (L, k);
- lua_rawseti (L, -3, i);
- lua_pushnumber (L, s->score);
- lua_rawseti (L, -2, i);
- i ++;
+ if (!(s->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) {
+ lua_pushstring (L, k);
+ lua_rawseti (L, -3, i);
+ lua_pushnumber (L, s->score);
+ lua_rawseti (L, -2, i);
+ i++;
+ }
}
}
else {
g_hash_table_iter_init (&it, mres->symbols);
while (g_hash_table_iter_next (&it, &k, &v)) {
- id = rspamd_symbols_cache_find_symbol (task->cfg->cache,
- k);
s = v;
- lua_pushnumber (L, id);
- lua_rawseti (L, -3, i);
- lua_pushnumber (L, s->score);
- lua_rawseti (L, -2, i);
- i ++;
+
+ if (!(s->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) {
+ id = rspamd_symbols_cache_find_symbol (task->cfg->cache,
+ k);
+ lua_pushnumber (L, id);
+ lua_rawseti (L, -3, i);
+ lua_pushnumber (L, s->score);
+ lua_rawseti (L, -2, i);
+ i++;
+ }
}
}
else {