Add label "attachment" when an attachment is seen.
authorCarl Worth <cworth@cworth.org>
Wed, 14 Oct 2009 23:18:17 +0000 (16:18 -0700)
committerCarl Worth <cworth@cworth.org>
Wed, 14 Oct 2009 23:20:26 +0000 (16:20 -0700)
notmuch-index-message.cc

index 5396cd19458fe0b5fc2833545da9aa6b7c345fe0..2d0bfc28680312753018cc43bb7c628a8b7828f6 100644 (file)
@@ -412,6 +412,7 @@ gen_terms_part (Xapian::TermGenerator term_gen,
     GMimeStream *stream;
     GMimeDataWrapper *wrapper;
     GByteArray *byte_array;
+    GMimeContentDisposition *disposition;
     char *body;
 
     if (GMIME_IS_MULTIPART (part)) {
@@ -438,6 +439,13 @@ gen_terms_part (Xapian::TermGenerator term_gen,
        return;
     }
 
+    disposition = g_mime_object_get_content_disposition (GMIME_OBJECT (part));
+    if (disposition &&
+       strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0)
+    {
+       add_term (term_gen.get_document (), "label", "attachment");
+    }
+
     byte_array = g_byte_array_new ();
 
     stream = g_mime_stream_mem_new_with_byte_array (byte_array);