]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-index-message.cc
Avoid trimming initial whitespace while looking for signatures.
[notmuch] / notmuch-index-message.cc
index 2d0bfc28680312753018cc43bb7c628a8b7828f6..79ec81e40c50a956d510980be5bf4682666fffbf 100644 (file)
@@ -379,8 +379,8 @@ gen_terms_body_str (Xapian::TermGenerator term_gen,
        }
        line_end = next_line - 1;
 
-       /* Trim whitespace. */
-       while (*next_line && isspace (*next_line))
+       /* Get to the next non-blank line. */
+       while (*next_line == '\n')
            next_line++;
 
        /* Skip lines that are quotes. */
@@ -439,11 +439,25 @@ gen_terms_part (Xapian::TermGenerator term_gen,
        return;
     }
 
-    disposition = g_mime_object_get_content_disposition (GMIME_OBJECT (part));
+    disposition = g_mime_object_get_content_disposition (part);
     if (disposition &&
        strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
     {
+       const char *filename = g_mime_part_get_filename (GMIME_PART (part));
+       const char *extension;
+
        add_term (term_gen.get_document (), "label", "attachment");
+       gen_terms (term_gen, "attachment", filename);
+
+       if (filename) {
+           extension = strchr (filename, '.');
+           if (extension) {
+               add_term (term_gen.get_document (), "attachment_extension",
+                         extension + 1);
+           }
+       }
+
+       return;
     }
 
     byte_array = g_byte_array_new ();