X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-index-message.cc;h=636757a165ac68e47a56af69817c25496afa1123;hp=852f4e16259fba6fee4d5e51918f856a4c6702b4;hb=29974af08f2eb3ebdff3ae1052a07b6d7361d511;hpb=7878175ed943351c39ce5cebc6f10939b2b88422 diff --git a/notmuch-index-message.cc b/notmuch-index-message.cc index 852f4e16..636757a1 100644 --- a/notmuch-index-message.cc +++ b/notmuch-index-message.cc @@ -269,12 +269,23 @@ static void insert_thread_id (GHashTable *thread_ids, Xapian::Document doc) { string value_string; - const char *value; + const char *value, *id, *comma; value_string = doc.get_value (NOTMUCH_VALUE_THREAD); value = value_string.c_str(); - if (strlen (value)) - g_hash_table_insert (thread_ids, strdup (value), NULL); + if (strlen (value)) { + id = value; + while (*id) { + comma = strchr (id, ','); + if (comma == NULL) + comma = id + strlen (id); + g_hash_table_insert (thread_ids, + strndup (id, comma - id), NULL); + id = comma; + if (*id) + id++; + } + } } /* Return one or more thread_ids, (as a GPtrArray of strings), for the @@ -401,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)) { @@ -427,6 +439,16 @@ gen_terms_part (Xapian::TermGenerator term_gen, return; } + disposition = g_mime_object_get_content_disposition (part); + if (disposition && + strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0) + { + add_term (term_gen.get_document (), "label", "attachment"); + gen_terms (term_gen, "attachment", + g_mime_part_get_filename (GMIME_PART (part))); + return; + } + byte_array = g_byte_array_new (); stream = g_mime_stream_mem_new_with_byte_array (byte_array); @@ -436,6 +458,7 @@ gen_terms_part (Xapian::TermGenerator term_gen, g_object_unref (stream); + g_byte_array_append (byte_array, (guint8 *) "\0", 1); body = (char *) g_byte_array_free (byte_array, FALSE); gen_terms_body_str (term_gen, body);