#include "util.h"
#include "expressions.h"
#include "settings.h"
+#include "view.h"
#include "classifiers/classifiers.h"
#include "tokenizers/tokenizers.h"
task->save.saved = 0;
return continue_process_filters (task);
}
+ /* Check skip */
+ if (check_skip (task->cfg->views, task)) {
+ task->is_skipped = TRUE;
+ task->state = WRITE_REPLY;
+ msg_info ("process_filters: disable check for message id <%s>, view wants spam", task->message_id);
+ return 1;
+ }
/* Check want spam setting */
if (check_want_spam (task)) {
+ task->is_skipped = TRUE;
+ task->state = WRITE_REPLY;
msg_info ("process_filters: disable check for message id <%s>, user wants spam", task->message_id);
return 1;
}
f_str_t c;
cur = g_list_first (task->text_parts);
+ ctx = cl->classifier->init_func (task->task_pool, cl);
+
if ((tokens = g_hash_table_lookup (data->tokens, cl->tokenizer)) == NULL) {
while (cur != NULL) {
text_part = (struct mime_text_part *)cur->data;
return;
}
- ctx = cl->classifier->init_func (task->task_pool, cl);
cl->classifier->classify_func (ctx, task->worker->srv->statfile_pool, tokens, task);
/* Autolearning */
process_statfiles (struct worker_task *task)
{
struct statfile_callback_data cd;
-
+
+ if (task->is_skipped) {
+ return;
+ }
cd.task = task;
cd.tokens = g_hash_table_new (g_direct_hash, g_direct_equal);
}
else {
if (strcmp (task->proto_ver, RSPAMC_PROTO_1_1) == 0) {
- r = snprintf (outbuf, sizeof (outbuf), "Metric: default; False; 0 / %.2f / %.2f" CRLF, ms, rs);
+ if (!task->is_skipped) {
+ r = snprintf (outbuf, sizeof (outbuf), "Metric: default; False; 0 / %.2f / %.2f" CRLF, ms, rs);
+ }
+ else {
+ r = snprintf (outbuf, sizeof (outbuf), "Metric: default; Skip; 0 / %.2f / %.2f" CRLF, ms, rs);
+ }
}
else {
r = snprintf (outbuf, sizeof (outbuf), "Metric: default; False; 0 / %.2f" CRLF, ms);
}
}
- cd->log_offset += snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset, "(%s: F: [0/%.2f/%.2f] [", "default", ms, rs);
+ if (!task->is_skipped) {
+ cd->log_offset += snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset, "(%s: F: [0/%.2f/%.2f] [", "default", ms, rs);
+ }
+ else {
+ cd->log_offset += snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset, "(%s: S: [0/%.2f/%.2f] [", "default", ms, rs);
+ }
}
else {
if (!check_metric_settings (task, metric_res->metric, &ms, &rs)) {
}
else {
if (strcmp (task->proto_ver, RSPAMC_PROTO_1_1) == 0) {
- r = snprintf (outbuf, sizeof (outbuf), "Metric: %s; %s; %.2f / %.2f / %.2f" CRLF,
+ if (!task->is_skipped) {
+ r = snprintf (outbuf, sizeof (outbuf), "Metric: %s; %s; %.2f / %.2f / %.2f" CRLF,
(char *)metric_name, (is_spam) ? "True" : "False", metric_res->score, ms, rs);
+ }
+ else {
+ r = snprintf (outbuf, sizeof (outbuf), "Metric: %s; Skip; %.2f / %.2f / %.2f" CRLF,
+ (char *)metric_name, metric_res->score, ms, rs);
+ }
}
else {
r = snprintf (outbuf, sizeof (outbuf), "Metric: %s; %s; %.2f / %.2f" CRLF,
(char *)metric_name, (is_spam) ? "True" : "False", metric_res->score, ms);
}
}
- cd->log_offset += snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset, "(%s: %s: [%.2f/%.2f/%.2f] [",
+ if (!task->is_skipped) {
+ cd->log_offset += snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset, "(%s: %s: [%.2f/%.2f/%.2f] [",
(char *)metric_name, is_spam ? "T" : "F", metric_res->score, ms, rs);
+ }
+ else {
+ cd->log_offset += snprintf (cd->log_buf + cd->log_offset, cd->log_size - cd->log_offset, "(%s: %s: [%.2f/%.2f/%.2f] [",
+ (char *)metric_name, "S", metric_res->score, ms, rs);
+
+ }
}
if (task->cmd == CMD_PROCESS) {
#ifndef GMIME24