aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-06 14:24:07 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-06 14:24:07 +0000
commitdf9ada40a53a804d2d90d9dfddc149a68c141a15 (patch)
treeecf56c7cf18b8a95b2fc6a38933ea7dd142c432b /src/libserver
parent1622570f58b5f5b184f97cd75a52a98cc0b1721a (diff)
downloadrspamd-df9ada40a53a804d2d90d9dfddc149a68c141a15.tar.gz
rspamd-df9ada40a53a804d2d90d9dfddc149a68c141a15.zip
Add learning implementation.
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/task.c9
-rw-r--r--src/libserver/task.h16
2 files changed, 17 insertions, 8 deletions
diff --git a/src/libserver/task.c b/src/libserver/task.c
index 290101023..579cc3461 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -610,11 +610,7 @@ rspamd_learn_task_spam (struct rspamd_task *task,
const gchar *classifier,
GError **err)
{
- return rspamd_stat_learn (task,
- is_spam,
- task->cfg->lua_state,
- classifier,
- err);
+ return FALSE;
}
static gboolean
@@ -999,7 +995,8 @@ rspamd_task_write_log (struct rspamd_task *task)
g_assert (task != NULL);
- if (task->cfg->log_format == NULL || task->flags & RSPAMD_TASK_FLAG_NO_LOG) {
+ if (task->cfg->log_format == NULL ||
+ (task->flags & RSPAMD_TASK_FLAG_NO_LOG)) {
return;
}
diff --git a/src/libserver/task.h b/src/libserver/task.h
index ed18d99d0..901067ba4 100644
--- a/src/libserver/task.h
+++ b/src/libserver/task.h
@@ -65,8 +65,11 @@ enum rspamd_task_stage {
RSPAMD_TASK_STAGE_CLASSIFIERS_POST = (1 << 7),
RSPAMD_TASK_STAGE_COMPOSITES = (1 << 8),
RSPAMD_TASK_STAGE_POST_FILTERS = (1 << 9),
- RSPAMD_TASK_STAGE_DONE = (1 << 10),
- RSPAMD_TASK_STAGE_REPLIED = (1 << 11)
+ RSPAMD_TASK_STAGE_LEARN_PRE = (1 << 10),
+ RSPAMD_TASK_STAGE_LEARN = (1 << 11),
+ RSPAMD_TASK_STAGE_LEARN_POST = (1 << 12),
+ RSPAMD_TASK_STAGE_DONE = (1 << 13),
+ RSPAMD_TASK_STAGE_REPLIED = (1 << 14)
};
#define RSPAMD_TASK_PROCESS_ALL (RSPAMD_TASK_STAGE_CONNECT | \
@@ -79,10 +82,16 @@ enum rspamd_task_stage {
RSPAMD_TASK_STAGE_CLASSIFIERS_POST | \
RSPAMD_TASK_STAGE_COMPOSITES | \
RSPAMD_TASK_STAGE_POST_FILTERS | \
+ RSPAMD_TASK_STAGE_LEARN_PRE | \
+ RSPAMD_TASK_STAGE_LEARN | \
+ RSPAMD_TASK_STAGE_LEARN_POST | \
RSPAMD_TASK_STAGE_DONE)
#define RSPAMD_TASK_PROCESS_LEARN (RSPAMD_TASK_STAGE_CONNECT | \
RSPAMD_TASK_STAGE_ENVELOPE | \
RSPAMD_TASK_STAGE_READ_MESSAGE | \
+ RSPAMD_TASK_STAGE_CLASSIFIERS_PRE | \
+ RSPAMD_TASK_STAGE_CLASSIFIERS | \
+ RSPAMD_TASK_STAGE_CLASSIFIERS_POST | \
RSPAMD_TASK_STAGE_DONE)
#define RSPAMD_TASK_FLAG_MIME (1 << 0)
@@ -99,11 +108,14 @@ enum rspamd_task_stage {
#define RSPAMD_TASK_FLAG_GTUBE (1 << 11)
#define RSPAMD_TASK_FLAG_FILE (1 << 12)
#define RSPAMD_TASK_FLAG_NO_STAT (1 << 13)
+#define RSPAMD_TASK_FLAG_UNLEARN (1 << 14)
+#define RSPAMD_TASK_FLAG_ALREADY_LEARNED (1 << 15)
#define RSPAMD_TASK_IS_SKIPPED(task) (((task)->flags & RSPAMD_TASK_FLAG_SKIP))
#define RSPAMD_TASK_IS_JSON(task) (((task)->flags & RSPAMD_TASK_FLAG_JSON))
#define RSPAMD_TASK_IS_SPAMC(task) (((task)->flags & RSPAMD_TASK_FLAG_SPAMC))
#define RSPAMD_TASK_IS_PROCESSED(task) (((task)->processed_stages & RSPAMD_TASK_STAGE_DONE))
+#define RSPAMD_TASK_IS_CLASSIFIED(task) (((task)->processed_stages & RSPAMD_TASK_STAGE_CLASSIFIERS))
typedef gint (*protocol_reply_func)(struct rspamd_task *task);