gpointer (*init)(struct rspamd_stat_ctx *ctx, struct rspamd_config *cfg);
gpointer (*runtime)(struct rspamd_task *task,
struct rspamd_statfile_config *stcf, gboolean learn, gpointer ctx);
- gboolean (*process_token)(struct token_node_s *tok,
+ gboolean (*process_token)(struct rspamd_task *task, struct token_node_s *tok,
struct rspamd_token_result *res, gpointer ctx);
- gboolean (*learn_token)(struct token_node_s *tok,
+ gboolean (*learn_token)(struct rspamd_task *task, struct token_node_s *tok,
struct rspamd_token_result *res, gpointer ctx);
- gulong (*total_learns)(struct rspamd_statfile_runtime *runtime, gpointer ctx);
- void (*finalize_learn)(struct rspamd_statfile_runtime *runtime, gpointer ctx);
- gulong (*inc_learns)(struct rspamd_statfile_runtime *runtime, gpointer ctx);
- gulong (*dec_learns)(struct rspamd_statfile_runtime *runtime, gpointer ctx);
- ucl_object_t* (*get_stat)(struct rspamd_statfile_runtime *runtime, gpointer ctx);
+ gulong (*total_learns)(struct rspamd_task *task,
+ gpointer runtime, gpointer ctx);
+ void (*finalize_learn)(struct rspamd_task *task,
+ gpointer runtime, gpointer ctx);
+ gulong (*inc_learns)(struct rspamd_task *task,
+ gpointer runtime, gpointer ctx);
+ gulong (*dec_learns)(struct rspamd_task *task,
+ gpointer runtime, gpointer ctx);
+ ucl_object_t* (*get_stat)(gpointer runtime, gpointer ctx);
void (*close)(gpointer ctx);
gpointer ctx;
};
gpointer rspamd_##name##_runtime (struct rspamd_task *task, \
struct rspamd_statfile_config *stcf, \
gboolean learn, gpointer ctx); \
- gboolean rspamd_##name##_process_token (struct token_node_s *tok, \
+ gboolean rspamd_##name##_process_token (struct rspamd_task *task, \
+ struct token_node_s *tok, \
struct rspamd_token_result *res, \
gpointer ctx); \
- gboolean rspamd_##name##_learn_token (struct token_node_s *tok, \
+ gboolean rspamd_##name##_learn_token (struct rspamd_task *task, \
+ struct token_node_s *tok, \
struct rspamd_token_result *res, \
gpointer ctx); \
- void rspamd_##name##_finalize_learn (gpointer runtime, \
+ void rspamd_##name##_finalize_learn (struct rspamd_task *task, \
+ gpointer runtime, \
gpointer ctx); \
- gulong rspamd_##name##_total_learns (gpointer runtime, \
+ gulong rspamd_##name##_total_learns (struct rspamd_task *task, \
+ gpointer runtime, \
gpointer ctx); \
- gulong rspamd_##name##_inc_learns (gpointer runtime, \
+ gulong rspamd_##name##_inc_learns (struct rspamd_task *task, \
+ gpointer runtime, \
gpointer ctx); \
- gulong rspamd_##name##_dec_learns (gpointer runtime, \
- gpointer ctx); \
- gulong rspamd_##name##_learns (gpointer runtime, \
+ gulong rspamd_##name##_dec_learns (struct rspamd_task *task, \
+ gpointer runtime, \
+ gpointer ctx); \
+ gulong rspamd_##name##_learns (struct rspamd_task *task, \
+ gpointer runtime, \
gpointer ctx); \
ucl_object_t * rspamd_##name##_get_stat (gpointer runtime, \
gpointer ctx); \
}
gboolean
-rspamd_mmaped_file_process_token (rspamd_token_t *tok,
+rspamd_mmaped_file_process_token (struct rspamd_task *task, rspamd_token_t *tok,
struct rspamd_token_result *res,
gpointer p)
{
}
gboolean
-rspamd_mmaped_file_learn_token (rspamd_token_t *tok,
+rspamd_mmaped_file_learn_token (struct rspamd_task *task, rspamd_token_t *tok,
struct rspamd_token_result *res,
gpointer p)
{
}
gulong
-rspamd_mmaped_file_total_learns (gpointer runtime,
+rspamd_mmaped_file_total_learns (struct rspamd_task *task, gpointer runtime,
gpointer ctx)
{
rspamd_mmaped_file_t *mf = (rspamd_mmaped_file_t *)runtime;
}
gulong
-rspamd_mmaped_file_inc_learns (gpointer runtime,
+rspamd_mmaped_file_inc_learns (struct rspamd_task *task, gpointer runtime,
gpointer ctx)
{
rspamd_mmaped_file_t *mf = (rspamd_mmaped_file_t *)runtime;
}
gulong
-rspamd_mmaped_file_dec_learns (gpointer runtime,
+rspamd_mmaped_file_dec_learns (struct rspamd_task *task, gpointer runtime,
gpointer ctx)
{
rspamd_mmaped_file_t *mf = (rspamd_mmaped_file_t *)runtime;
}
void
-rspamd_mmaped_file_finalize_learn (gpointer runtime,
+rspamd_mmaped_file_finalize_learn (struct rspamd_task *task, gpointer runtime,
gpointer ctx)
{
rspamd_mmaped_file_t *mf = (rspamd_mmaped_file_t *)runtime;
}
gboolean
-rspamd_sqlite3_process_token (struct token_node_s *tok,
+rspamd_sqlite3_process_token (struct rspamd_task *task, struct token_node_s *tok,
struct rspamd_token_result *res, gpointer p)
{
struct rspamd_stat_sqlite3_db *bk;
}
gboolean
-rspamd_sqlite3_learn_token (struct token_node_s *tok,
+rspamd_sqlite3_learn_token (struct rspamd_task *task, struct token_node_s *tok,
struct rspamd_token_result *res, gpointer p)
{
struct rspamd_stat_sqlite3_db *bk;
}
void
-rspamd_sqlite3_finalize_learn (gpointer runtime,
+rspamd_sqlite3_finalize_learn (struct rspamd_task *task, gpointer runtime,
gpointer ctx)
{
struct rspamd_stat_sqlite3_db *bk = runtime;
}
gulong
-rspamd_sqlite3_total_learns (gpointer runtime,
+rspamd_sqlite3_total_learns (struct rspamd_task *task, gpointer runtime,
gpointer ctx)
{
struct rspamd_stat_sqlite3_db *bk = runtime;
}
gulong
-rspamd_sqlite3_inc_learns (gpointer runtime,
+rspamd_sqlite3_inc_learns (struct rspamd_task *task, gpointer runtime,
gpointer ctx)
{
struct rspamd_stat_sqlite3_db *bk = runtime;
}
gulong
-rspamd_sqlite3_dec_learns (gpointer runtime,
+rspamd_sqlite3_dec_learns (struct rspamd_task *task, gpointer runtime,
gpointer ctx)
{
struct rspamd_stat_sqlite3_db *bk = runtime;
}
gulong
-rspamd_sqlite3_learns (gpointer runtime,
+rspamd_sqlite3_learns (struct rspamd_task *task, gpointer runtime,
gpointer ctx)
{
struct rspamd_stat_sqlite3_db *bk = runtime;
res->cl_runtime = cl_runtime;
res->st_runtime = st_runtime;
- if (st_runtime->backend->process_token (t, res,
+ if (st_runtime->backend->process_token (cbdata->task, t, res,
st_runtime->backend->ctx)) {
if (cl_runtime->clcf->max_tokens > 0 &&
st_runtime->backend = bk;
if (stcf->is_spam) {
- cl_runtime->total_spam += bk->total_learns (backend_runtime,
+ cl_runtime->total_spam += bk->total_learns (task, backend_runtime,
bk->ctx);
}
else {
- cl_runtime->total_ham += bk->total_learns (backend_runtime,
+ cl_runtime->total_ham += bk->total_learns (task, backend_runtime,
bk->ctx);
}
res = &g_array_index (t->results, struct rspamd_token_result, i);
st_runtime = (struct rspamd_statfile_runtime *)curst->data;
- if (st_runtime->backend->learn_token (t, res,
+ if (st_runtime->backend->learn_token (cbdata->task, t, res,
st_runtime->backend->ctx)) {
cl_runtime->processed_tokens ++;
st_run = (struct rspamd_statfile_runtime *)curst->data;
if (unlearn && spam != st_run->st->is_spam) {
- nrev = st_run->backend->dec_learns (st_run->backend_runtime,
+ nrev = st_run->backend->dec_learns (task,
+ st_run->backend_runtime,
st_run->backend->ctx);
msg_debug ("unlearned %s, new revision: %ul",
st_run->st->symbol, nrev);
}
else {
- nrev = st_run->backend->inc_learns (st_run->backend_runtime,
+ nrev = st_run->backend->inc_learns (task,
+ st_run->backend_runtime,
st_run->backend->ctx);
msg_debug ("learned %s, new revision: %ul",
st_run->st->symbol, nrev);
}
- st_run->backend->finalize_learn (st_run->backend_runtime,
+ st_run->backend->finalize_learn (task,
+ st_run->backend_runtime,
st_run->backend->ctx);
curst = g_list_next (curst);
backend_runtime = bk->runtime (NULL, stcf, FALSE, bk->ctx);
- learns += bk->total_learns (backend_runtime, bk->ctx);
+ learns += bk->total_learns (NULL, backend_runtime, bk->ctx);
elt = bk->get_stat (backend_runtime, bk->ctx);
if (elt != NULL) {