This prepares the codebase for a cleaner changeset for dealing with indexing some encrypted messages in the clear. --- lib/index.cc | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/lib/index.cc b/lib/index.cc index 8c14554..1c030a6 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -333,27 +333,26 @@ _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. */ - if (i == 1) - continue; - if (i > 1) - _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. */ - continue; - } + if (GMIME_IS_MULTIPART_SIGNED (multipart)) { + _notmuch_message_add_term (message, "tag", "signed"); + /* FIXME: should we try to validate the signature? */ + + /* FIXME: is it always just the first part that is signed in + all multipart/signed messages?*/ _index_mime_part (message, - g_mime_multipart_get_part (multipart, i)); + g_mime_multipart_get_part (multipart, 0)); + + if (g_mime_multipart_get_count (multipart) > 2) + _notmuch_database_log (_notmuch_message_database (message), + "Warning: Unexpected extra parts of multipart/signed. Indexing anyway.\n"); + } else if (GMIME_IS_MULTIPART_ENCRYPTED (multipart)) { + /* Don't index encrypted parts */ + _notmuch_message_add_term (message, "tag", "encrypted"); + } else { + for (i = 0; i < g_mime_multipart_get_count (multipart); i++) { + _index_mime_part (message, + g_mime_multipart_get_part (multipart, i)); + } } return; } -- 2.8.1 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch