X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Findex.cc;h=8c145540cbce0e285216470b59d47ef1a48efcde;hp=1a2e63df58e45a2f163f7ca61ab6a7740032314a;hb=e08f5f76e406de2c6bdcf85952aaeb66ec0d37de;hpb=cc2722ba9e1b2854c5500eb7bb41910478aa8fce diff --git a/lib/index.cc b/lib/index.cc index 1a2e63df..8c145540 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ . + * along with this program. If not, see https://www.gnu.org/licenses/ . * * Author: Carl Worth */ @@ -144,7 +144,7 @@ filter_filter (GMimeFilter *gmime_filter, char *inbuf, size_t inlen, size_t pres {9, ' ', ' ', 10, 0}, {10, '\n', '\n', 11, 10}, {11, 'M', 'M', 12, 0}, - {12, ' ', '`', 12, 11} + {12, ' ', '`', 12, 11} }; int next; @@ -314,10 +314,21 @@ _index_mime_part (notmuch_message_t *message, const char *charset; if (! part) { - fprintf (stderr, "Warning: Not indexing empty mime part.\n"); + _notmuch_database_log (_notmuch_message_database (message), + "Warning: Not indexing empty mime part.\n"); return; } + GMimeContentType *content_type = g_mime_object_get_content_type(part); + if (content_type) { + char *mime_string = g_mime_content_type_to_string(content_type); + if (mime_string) + { + _notmuch_message_gen_terms (message, "mimetype", mime_string); + g_free(mime_string); + } + } + if (GMIME_IS_MULTIPART (part)) { GMimeMultipart *multipart = GMIME_MULTIPART (part); int i; @@ -334,7 +345,8 @@ _index_mime_part (notmuch_message_t *message, if (i == 1) continue; if (i > 1) - fprintf (stderr, "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n"); + _notmuch_database_log (_notmuch_message_database (message), + "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n"); } if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) { /* Don't index encrypted parts. */ @@ -357,14 +369,16 @@ _index_mime_part (notmuch_message_t *message, } if (! (GMIME_IS_PART (part))) { - fprintf (stderr, "Warning: Not indexing unknown mime part: %s.\n", - g_type_name (G_OBJECT_TYPE (part))); + _notmuch_database_log (_notmuch_message_database (message), + "Warning: Not indexing unknown mime part: %s.\n", + g_type_name (G_OBJECT_TYPE (part))); return; } disposition = g_mime_object_get_content_disposition (part); if (disposition && - strcmp (disposition->disposition, GMIME_DISPOSITION_ATTACHMENT) == 0) + strcasecmp (g_mime_content_disposition_get_disposition (disposition), + GMIME_DISPOSITION_ATTACHMENT) == 0) { const char *filename = g_mime_part_get_filename (GMIME_PART (part));