From: Vsevolod Stakhov Date: Wed, 21 Jun 2017 17:59:02 +0000 (+0100) Subject: [Minor] Add some more data to the spaces strip algorithm X-Git-Tag: 1.6.2~92 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d7fd796275d2edd16da117521b4eef29bea21864;p=rspamd.git [Minor] Add some more data to the spaces strip algorithm --- 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 {