aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/emails.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-16 20:43:26 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-16 20:43:26 +0400
commita639bf512e3df778fa33c49d83c3996c9fe60d77 (patch)
tree072c4167dae82382b1c8eef93e0270339635e389 /src/plugins/emails.c
parentc4aab3053d2839e6d3b99f8a542b0a4f54f2b856 (diff)
downloadrspamd-a639bf512e3df778fa33c49d83c3996c9fe60d77.tar.gz
rspamd-a639bf512e3df778fa33c49d83c3996c9fe60d77.zip
* Change metric logic
* Completely remove lex/yacc readers for config * Make common sense of metric/action and symbols * Sync changes with all plugins TODO: add this to documentation
Diffstat (limited to 'src/plugins/emails.c')
-rw-r--r--src/plugins/emails.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/plugins/emails.c b/src/plugins/emails.c
index 37d0b8d33..ed6702396 100644
--- a/src/plugins/emails.c
+++ b/src/plugins/emails.c
@@ -26,7 +26,6 @@
* rspamd module that extracts emails from messages and check them via blacklist
*
* Allowed options:
- * - metric (string): metric to insert symbol (default: 'default')
* - symbol (string): symbol to insert (default: 'R_BAD_EMAIL')
* - blacklist (map string): map that contains list of bad emails
*/
@@ -48,7 +47,6 @@ static const char *email_re_text =
struct email_ctx {
int (*filter) (struct worker_task * task);
- char *metric;
char *symbol;
GRegex *email_re;
@@ -89,15 +87,7 @@ emails_module_config (struct config_file *cfg)
{
char *value;
int res = TRUE;
- struct metric *metric;
- double *w;
- if ((value = get_module_opt (cfg, "emails", "metric")) != NULL) {
- email_module_ctx->metric = memory_pool_strdup (email_module_ctx->email_pool, value);
- }
- else {
- email_module_ctx->metric = DEFAULT_METRIC;
- }
if ((value = get_module_opt (cfg, "emails", "symbol")) != NULL) {
email_module_ctx->symbol = memory_pool_strdup (email_module_ctx->email_pool, value);
}
@@ -110,20 +100,8 @@ emails_module_config (struct config_file *cfg)
}
}
- metric = g_hash_table_lookup (cfg->metrics, email_module_ctx->metric);
- if (metric == NULL) {
- msg_err ("cannot find metric definition %s", email_module_ctx->metric);
- return FALSE;
- }
- /* Search in factors hash table */
- w = g_hash_table_lookup (cfg->factors, email_module_ctx->symbol);
- if (w == NULL) {
- register_symbol (&metric->cache, email_module_ctx->symbol, 1, emails_symbol_callback, NULL);
- }
- else {
- register_symbol (&metric->cache, email_module_ctx->symbol, *w, emails_symbol_callback, NULL);
- }
+ register_symbol (&cfg->cache, email_module_ctx->symbol, 1, emails_symbol_callback, NULL);
return res;
}
@@ -233,7 +211,7 @@ emails_symbol_callback (struct worker_task *task, void *unused)
while (cur) {
if (g_hash_table_lookup (email_module_ctx->blacklist, cur->data) != NULL) {
- insert_result (task, email_module_ctx->metric, email_module_ctx->symbol, 1, g_list_prepend (NULL, memory_pool_strdup (task->task_pool, (char *)cur->data)));
+ insert_result (task, email_module_ctx->symbol, 1, g_list_prepend (NULL, memory_pool_strdup (task->task_pool, (char *)cur->data)));
}
cur = g_list_next (cur);