X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=lib%2Findex.cc;h=d8f8b2bf516247ccc14aec8927dc5ae703a830d3;hb=57702cc43017cfd5c5ad65a986ef962f5e40cd59;hp=0d6640bce57e59a657f6d7287d68aac535bd5534;hpb=449a418c65fb1f9281f761aae23576900d0d3ef1;p=notmuch diff --git a/lib/index.cc b/lib/index.cc index 0d6640bc..d8f8b2bf 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -63,7 +63,7 @@ struct _NotmuchFilterDiscardUuencodeClass { GMimeFilterClass parent_class; }; -GMimeFilter *notmuch_filter_discard_uuencode_new (void); +static GMimeFilter *notmuch_filter_discard_uuencode_new (void); static void notmuch_filter_discard_uuencode_finalize (GObject *object); @@ -195,7 +195,7 @@ filter_reset (GMimeFilter *gmime_filter) * * Returns: a new #NotmuchFilterDiscardUuencode filter. **/ -GMimeFilter * +static GMimeFilter * notmuch_filter_discard_uuencode_new (void) { static GType type = 0; @@ -304,26 +304,6 @@ _index_address_list (notmuch_message_t *message, } } -static const char * -skip_re_in_subject (const char *subject) -{ - const char *s = subject; - - if (subject == NULL) - return NULL; - - while (*s) { - while (*s && isspace (*s)) - s++; - if (strncasecmp (s, "re:", 3) == 0) - s += 3; - else - break; - } - - return s; -} - /* Callback to generate terms for each mime part of a message. */ static void _index_mime_part (notmuch_message_t *message, @@ -345,6 +325,12 @@ _index_mime_part (notmuch_message_t *message, GMimeMultipart *multipart = GMIME_MULTIPART (part); int i; + if (GMIME_IS_MULTIPART_SIGNED (multipart)) + _notmuch_message_add_term (message, "tag", "signed"); + + if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) + _notmuch_message_add_term (message, "tag", "encrypted"); + for (i = 0; i < g_mime_multipart_get_count (multipart); i++) { if (GMIME_IS_MULTIPART_SIGNED (multipart)) { /* Don't index the signature. */ @@ -353,6 +339,10 @@ _index_mime_part (notmuch_message_t *message, if (i > 1) fprintf (stderr, "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n"); } + if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) { + /* Don't index encrypted parts. */ + continue; + } _index_mime_part (message, g_mime_multipart_get_part (multipart, i)); } @@ -459,7 +449,6 @@ _notmuch_message_index_file (notmuch_message_t *message, _index_address_list (message, "to", addresses); subject = g_mime_message_get_subject (mime_message); - subject = skip_re_in_subject (subject); _notmuch_message_gen_terms (message, "subject", subject); _index_mime_part (message, g_mime_message_get_mime_part (mime_message));