]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add some more data to the spaces strip algorithm
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 21 Jun 2017 17:59:02 +0000 (18:59 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 21 Jun 2017 18:06:30 +0000 (19:06 +0100)
src/libmime/message.c
src/libmime/message.h

index e328585cf7bb63d48141a62047ee182fb687b314..0d495fcd820733aa0c01cee0b1de7dde17090eef 100644 (file)
@@ -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 ++;
index 8c82300c38594e102b14d1f8b3363aad924131a7..599521f6f423ee90447c02ef33943bcacf469282 100644 (file)
@@ -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 {