]> source.dussan.org Git - rspamd.git/commitdiff
* Tokenize subject using osb tokenizer.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 11 Feb 2011 13:01:23 +0000 (16:01 +0300)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 11 Feb 2011 13:01:23 +0000 (16:01 +0300)
src/tokenizers/tokenizers.c

index 1c1f6d9a854890d84662be83241800e651a87c7c..9c3e7f1f9a5ac1b103e1e22022289add0a1afb78 100644 (file)
@@ -254,38 +254,30 @@ tokenize_headers (memory_pool_t * pool, struct worker_task *task, GTree ** tree)
 void
 tokenize_subject (struct worker_task *task, GTree ** tree)
 {
-       f_str_t                         subject, subject_name;
+       f_str_t                         subject;
        const gchar                    *sub;
        token_node_t                   *new = NULL;
+       struct tokenizer               *osb_tokenizer;
 
        if (*tree == NULL) {
                *tree = g_tree_new (token_node_compare_func);
                memory_pool_add_destructor (task->task_pool, (pool_destruct_func) g_tree_destroy, *tree);
        }
 
-       subject_name.begin = "Subject:";
-       subject_name.len = sizeof ("Subject:") - 1;
+       osb_tokenizer = get_tokenizer ("osb");
 
        /* Try to use pre-defined subject */
        if (task->subject != NULL) {
                new = memory_pool_alloc (task->task_pool, sizeof (token_node_t));
                subject.begin = task->subject;
                subject.len = strlen (task->subject);
-               new->h1 = fstrhash (&subject_name) * primes[0];
-               new->h2 = fstrhash (&subject) * primes[1];
-               if (g_tree_lookup (*tree, new) == NULL) {
-                       g_tree_insert (*tree, new, new);
-               }
+               osb_tokenizer->tokenize_func (osb_tokenizer, task->task_pool, &subject, tree);
        }
        if ((sub = g_mime_message_get_subject (task->message)) != NULL) {
                new = memory_pool_alloc (task->task_pool, sizeof (token_node_t));
                subject.begin = (gchar *)sub;
                subject.len = strlen (sub);
-               new->h1 = fstrhash (&subject_name) * primes[0];
-               new->h2 = fstrhash (&subject) * primes[1];
-               if (g_tree_lookup (*tree, new) == NULL) {
-                       g_tree_insert (*tree, new, new);
-               }
+               osb_tokenizer->tokenize_func (osb_tokenizer, task->task_pool, &subject, tree);
        }
 }