aboutsummaryrefslogtreecommitdiffstats
path: root/src/filter.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-11-12 20:38:20 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-11-12 20:38:20 +0300
commit092a40dcf813accb11a0b6bb600dccea0b35fb1d (patch)
treebc15b37adda2a21575799204dbc528874d2e82c2 /src/filter.c
parent1ad9f1f651ef3f0ee26d69007dd27e60f99f1f12 (diff)
downloadrspamd-092a40dcf813accb11a0b6bb600dccea0b35fb1d.tar.gz
rspamd-092a40dcf813accb11a0b6bb600dccea0b35fb1d.zip
* Write revision and revision time to statfile
* Make some improvements to API (trying to make it more clear)
Diffstat (limited to 'src/filter.c')
-rw-r--r--src/filter.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/filter.c b/src/filter.c
index ca3270f47..66a256708 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -473,23 +473,23 @@ check_autolearn (struct statfile_autolearn_params *params, struct worker_task *t
void
process_autolearn (struct statfile *st, struct worker_task *task, GTree * tokens, struct classifier *classifier, char *filename, struct classifier_ctx *ctx)
{
+ stat_file_t *statfile;
+ struct statfile *unused;
+
if (check_autolearn (st->autolearn, task)) {
if (tokens) {
msg_info ("process_autolearn: message with id <%s> autolearned statfile '%s'", task->message_id, filename);
- /* Check opened */
- if (!statfile_pool_is_open (task->worker->srv->statfile_pool, filename)) {
- /* Try open */
- if (statfile_pool_open (task->worker->srv->statfile_pool, filename, st->size, FALSE) == NULL) {
- /* Try create */
- if (statfile_pool_create (task->worker->srv->statfile_pool, filename, st->size) == -1) {
- msg_info ("process_autolearn: error while creating statfile %s", filename);
- return;
- }
- }
+
+ /* Get or create statfile */
+ statfile = get_statfile_by_symbol (task->worker->srv->statfile_pool, ctx->cfg,
+ st->symbol, &unused, TRUE);
+
+ if (statfile == NULL) {
+ return;
}
- classifier->learn_func (ctx, task->worker->srv->statfile_pool, st->symbol, tokens, TRUE);
- maybe_write_binlog (ctx->cfg, st->symbol, tokens);
+ classifier->learn_func (ctx, task->worker->srv->statfile_pool, statfile, tokens, TRUE);
+ maybe_write_binlog (ctx->cfg, st, statfile, tokens);
}
}
}