/* Actually, statistics should act like any ordinary symbol */
rspamd_symbols_cache_add_symbol (cfg->cache, key, 0, NULL, NULL,
- SYMBOL_TYPE_CLASSIFIER, -1);
+ SYMBOL_TYPE_CLASSIFIER|SYMBOL_TYPE_NOSTAT, -1);
}
void
}
}
+ if (type & (SYMBOL_TYPE_CLASSIFIER|SYMBOL_TYPE_CALLBACK|
+ SYMBOL_TYPE_PREFILTER|SYMBOL_TYPE_POSTFILTER)) {
+ type |= SYMBOL_TYPE_NOSTAT;
+ }
+
item = rspamd_mempool_alloc0 (cache->static_pool,
sizeof (struct cache_item));
item->st = rspamd_mempool_alloc0_shared (cache->static_pool,
SYMBOL_TYPE_EMPTY = (1 << 8), /* Allow execution on empty tasks */
SYMBOL_TYPE_PREFILTER = (1 << 9),
SYMBOL_TYPE_POSTFILTER = (1 << 10),
- SYMBOL_TYPE_NONSTAT = (1 << 11), /* Skip as statistical symbol */
+ SYMBOL_TYPE_NOSTAT = (1 << 11), /* Skip as statistical symbol */
};
/**
* + `nice` if symbol can produce negative score;
* + `empty` if symbol can be called for empty messages
* + `skip` if symbol should be skipped now
+ * + `nostat` if symbol should be excluded from stat tokens
* - `parent`: id of parent symbol (useful for virtual symbols)
*
* @return {number} id of symbol registered
if (strstr (str, "skip") != NULL) {
ret |= SYMBOL_TYPE_SKIPPED;
}
+ if (strstr (str, "nostat") != NULL) {
+ ret |= SYMBOL_TYPE_NOSTAT;
+ }
}
return ret;
struct tokens_foreach_cbdata *cbd = ud;
struct rspamd_symbol_result *s;
- if (flags & SYMBOL_TYPE_NONSTAT) {
+ if (flags & SYMBOL_TYPE_NOSTAT) {
return;
}
if configure_asn_module() then
local id = rspamd_config:register_symbol({
name = 'ASN_CHECK',
- type = 'prefilter',
+ type = 'prefilter,nostat',
callback = asn_check,
priority = 5,
})
})
local id = rspamd_config:register_symbol({
name = fann_symbol_spam,
- type = 'postfilter',
+ type = 'postfilter,nostat',
priority = 6,
callback = fann_scores_filter
})
})
rspamd_config:register_symbol({
name = fann_symbol_ham,
- type = 'virtual',
+ type = 'virtual,nostat',
parent = id
})
if opts['train'] then
end
rspamd_config:register_symbol({
name = 'FANN_VECTOR_PUSH',
- type = 'postfilter',
+ type = 'postfilter,nostat',
priority = 5,
callback = ann_push_vector
})
else
rspamd_config:register_symbol({
name = 'HISTORY_SAVE',
- type = 'postfilter',
+ type = 'postfilter,nostat',
callback = history_save,
priority = 150
})
if map then
local id = rspamd_config:register_symbol({
callback = check_mime_type,
- type = 'callback'
+ type = 'callback,nostat'
})
rspamd_config:register_symbol({
rspamd_config:register_symbol({
name = 'RATELIMIT_CHECK',
callback = rate_test,
- type = 'prefilter',
+ type = 'prefilter,nostat',
priority = 4,
})
else
local id = rspamd_config:register_symbol({
name = symbol,
callback = rate_test,
+ type = 'normal,nostat'
})
if use_ip_score then
rspamd_config:register_dependency(id, 'IP_SCORE')
end
rspamd_config:register_symbol({
name = 'RATELIMIT_SET',
- type = 'postfilter',
+ type = 'postfilter,nostat',
priority = 5,
callback = rate_set,
})
else
rspamd_config:register_symbol({
name = 'REPLIES_SET',
- type = 'postfilter',
+ type = 'postfilter,nostat',
callback = replies_set,
priority = 5
})
local id = rspamd_config:register_symbol({
name = 'REPLIES_CHECK',
- type = 'prefilter',
+ type = 'prefilter,nostat',
callback = replies_check,
priority = 10
})
fun.each(function(id, h)
rspamd_config:register_symbol({
name = 'REDIS_SETTINGS' .. tostring(id),
- type = 'prefilter',
+ type = 'prefilter,nostat',
callback = gen_redis_callback(h, id),
priority = 10
})
rspamd_config:register_symbol({
name = 'SETTINGS_CHECK',
- type = 'prefilter',
+ type = 'prefilter,nostat',
callback = check_settings,
priority = 10
})