aboutsummaryrefslogtreecommitdiffstats
path: root/src/filter.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-01-21 17:25:06 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-01-21 17:25:06 +0300
commit1dc0f6ad2c2e97e11881a7e1b0a4142e65f50898 (patch)
treef0a714e2e87ebd50f6016c8cc7f2a8e03a9cc2d8 /src/filter.c
parent87c9659fdd08bbbc0eb796afccf7237a03181498 (diff)
downloadrspamd-1dc0f6ad2c2e97e11881a7e1b0a4142e65f50898.tar.gz
rspamd-1dc0f6ad2c2e97e11881a7e1b0a4142e65f50898.zip
* Rewrite message parser
* Change mime parts storage * Add html tags striping (ported from php code) * Rework learning to process only text and striped html parts
Diffstat (limited to 'src/filter.c')
-rw-r--r--src/filter.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/filter.c b/src/filter.c
index 443784ad6..f45d718f2 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -6,6 +6,7 @@
#include "mem_pool.h"
#include "filter.h"
#include "main.h"
+#include "message.h"
#include "cfg_file.h"
#include "perl.h"
#include "util.h"
@@ -354,9 +355,12 @@ statfiles_callback (gpointer key, gpointer value, void *arg)
struct statfile_callback_data *data= (struct statfile_callback_data *)arg;
struct worker_task *task = data->task;
struct statfile *st = (struct statfile *)value;
- GTree *tokens;
+ GTree *tokens = NULL;
char *filename;
double weight, *w;
+ GList *cur = NULL;
+ GByteArray *content;
+ f_str_t c;
if (g_list_length (task->rcpt) == 1) {
filename = resolve_stat_filename (task->task_pool, st->pattern, task->from, (char *)task->rcpt->data);
@@ -371,11 +375,14 @@ statfiles_callback (gpointer key, gpointer value, void *arg)
}
if ((tokens = g_hash_table_lookup (data->tokens, st->tokenizer)) == NULL) {
- /* Tree would be freed at task pool freeing */
- tokens = st->tokenizer->tokenize_func (st->tokenizer, task->task_pool, task->msg->buf);
- if (tokens == NULL) {
- msg_info ("statfiles_callback: cannot tokenize input");
- return;
+ while ((content = get_next_text_part (task->task_pool, task->parts, &cur)) != NULL) {
+ c.begin = content->data;
+ c.len = content->len;
+ /* Tree would be freed at task pool freeing */
+ if (!st->tokenizer->tokenize_func (st->tokenizer, task->task_pool, &c, &tokens)) {
+ msg_info ("statfiles_callback: cannot tokenize input");
+ return;
+ }
}
g_hash_table_insert (data->tokens, st->tokenizer, tokens);
}