]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Core: Fix parts distance calculations
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 13 Dec 2018 15:45:00 +0000 (15:45 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 13 Dec 2018 15:45:00 +0000 (15:45 +0000)
src/libmime/message.c

index bbae5e42643d5987894688873cee8e50d62b34dc..63494202ddd661251bd2ebd4590677d71a589005 100644 (file)
@@ -1222,6 +1222,23 @@ rspamd_message_process (struct rspamd_task *task)
        rspamd_images_process (task);
        rspamd_archives_process (task);
 
+       /* Calculate average words length and number of short words */
+       struct rspamd_mime_text_part *text_part;
+       gdouble *var;
+       guint total_words = 0;
+
+       PTR_ARRAY_FOREACH (task->text_parts, i, text_part) {
+               if (!text_part->language) {
+                       rspamd_mime_part_detect_language (task, text_part);
+               }
+
+               rspamd_mime_part_extract_words (task, text_part);
+
+               if (text_part->utf_words) {
+                       total_words += text_part->nwords;
+               }
+       }
+
        /* Calculate distance for 2-parts messages */
        if (task->text_parts->len == 2) {
                p1 = g_ptr_array_index (task->text_parts, 0);
@@ -1311,23 +1328,6 @@ rspamd_message_process (struct rspamd_task *task)
                }
        }
 
-       /* Calculate average words length and number of short words */
-       struct rspamd_mime_text_part *text_part;
-       gdouble *var;
-       guint total_words = 0;
-
-       PTR_ARRAY_FOREACH (task->text_parts, i, text_part) {
-               if (!text_part->language) {
-                       rspamd_mime_part_detect_language (task, text_part);
-               }
-
-               rspamd_mime_part_extract_words (task, text_part);
-
-               if (text_part->utf_words) {
-                       total_words += text_part->nwords;
-               }
-       }
-
        if (total_words > 0) {
                var = rspamd_mempool_get_variable (task->task_pool,
                                RSPAMD_MEMPOOL_AVG_WORDS_LEN);