summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-13 15:45:00 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-12-13 15:45:00 +0000
commit8939b059fbe42e5386e7c05b42212c83da9a2c1f (patch)
tree9f85e7dbaf966ae1b952f6573a983c1a7d361c10 /src
parentdfe72148b895463ef139163a6a0d17a20f39700c (diff)
downloadrspamd-8939b059fbe42e5386e7c05b42212c83da9a2c1f.tar.gz
rspamd-8939b059fbe42e5386e7c05b42212c83da9a2c1f.zip
[Fix] Core: Fix parts distance calculations
Diffstat (limited to 'src')
-rw-r--r--src/libmime/message.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index bbae5e426..63494202d 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -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);