aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-21 18:59:02 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-06-21 19:06:30 +0100
commitd7fd796275d2edd16da117521b4eef29bea21864 (patch)
treef7237b2b84be6430aab08791ae87a71c8654022a /src/libmime
parent3f772ca4933e97aa15c15f8dc2a487c550a0a32d (diff)
downloadrspamd-d7fd796275d2edd16da117521b4eef29bea21864.tar.gz
rspamd-d7fd796275d2edd16da117521b4eef29bea21864.zip
[Minor] Add some more data to the spaces strip algorithm
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/message.c12
-rw-r--r--src/libmime/message.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/src/libmime/message.c b/src/libmime/message.c
index e328585cf..0d495fcd8 100644
--- a/src/libmime/message.c
+++ b/src/libmime/message.c
@@ -374,6 +374,7 @@ rspamd_strip_newlines_parse (const gchar *begin, const gchar *pe,
}
part->nlines ++;
+ part->empty_lines ++;
c = p + 1;
break;
case seen_lf:
@@ -436,6 +437,7 @@ rspamd_strip_newlines_parse (const gchar *begin, const gchar *pe,
}
part->nlines++;
+ part->empty_lines ++;
c = p + 1;
break;
@@ -459,6 +461,9 @@ rspamd_strip_newlines_parse (const gchar *begin, const gchar *pe,
if (G_UNLIKELY (*p & 0x80)) {
part->non_aciii_chars ++;
}
+ else {
+ part->ascii_chars ++;
+ }
}
break;
case seen_cr:
@@ -477,6 +482,10 @@ rspamd_strip_newlines_parse (const gchar *begin, const gchar *pe,
c ++;
part->spaces ++;
}
+
+ if (*p == '\r' || *p == '\n') {
+ part->empty_lines ++;
+ }
}
state = normal_char;
@@ -508,6 +517,9 @@ rspamd_strip_newlines_parse (const gchar *begin, const gchar *pe,
if (G_UNLIKELY (*p & 0x80)) {
part->non_aciii_chars ++;
}
+ else {
+ part->ascii_chars ++;
+ }
}
c ++;
diff --git a/src/libmime/message.h b/src/libmime/message.h
index 8c82300c3..599521f6f 100644
--- a/src/libmime/message.h
+++ b/src/libmime/message.h
@@ -97,8 +97,10 @@ struct rspamd_mime_text_part {
guint nlines;
guint spaces;
guint non_aciii_chars;
+ guint ascii_chars;
guint double_spaces;
guint non_spaces;
+ guint empty_lines;
};
enum rspamd_received_type {