From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id B76C06DE0C67 for ; Mon, 11 Dec 2017 23:18:21 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.027 X-Spam-Level: X-Spam-Status: No, score=-0.027 tagged_above=-999 required=5 tests=[AWL=-0.027] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ahRaCtJbc8aq for ; Mon, 11 Dec 2017 23:18:17 -0800 (PST) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTPS id DDE806DE0B6D for ; Mon, 11 Dec 2017 23:18:16 -0800 (PST) Received: from fifthhorseman.net (unknown [38.109.115.130]) by che.mayfirst.org (Postfix) with ESMTPSA id 86186F99F for ; Tue, 12 Dec 2017 02:18:16 -0500 (EST) Received: by fifthhorseman.net (Postfix, from userid 1000) id 52E4820D71; Tue, 12 Dec 2017 02:18:13 -0500 (EST) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH 3/5] index: tag text parts with inline PGP encryption as "encrypted" Date: Tue, 12 Dec 2017 02:15:51 -0500 Message-Id: <20171212071553.6440-4-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171212071553.6440-1-dkg@fifthhorseman.net> References: <20171212071553.6440-1-dkg@fifthhorseman.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Dec 2017 07:18:21 -0000 Assuming we have GMime 3.0 (which has efficient detection of inline PGP encrypted blobs) we should be able to mark those messages with the same tag that we mark PGP/MIME and S/MIME encrypted messages. --- lib/index.cc | 6 ++++++ test/T359-inline-pgp-decryption.sh | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/index.cc b/lib/index.cc index f144b9fb..e03f5230 100644 --- a/lib/index.cc +++ b/lib/index.cc @@ -468,6 +468,12 @@ _index_mime_part (notmuch_message_t *message, return; } +#if (GMIME_MAJOR_VERSION >= 3) + if (GMIME_IS_TEXT_PART (part) && g_mime_part_get_openpgp_data (GMIME_PART (part)) == GMIME_OPENPGP_DATA_ENCRYPTED) { + _notmuch_message_add_term (message, "tag", "encrypted"); + } +#endif + byte_array = g_byte_array_new (); stream = g_mime_stream_mem_new_with_byte_array (byte_array); diff --git a/test/T359-inline-pgp-decryption.sh b/test/T359-inline-pgp-decryption.sh index c0db8eaf..314ca786 100755 --- a/test/T359-inline-pgp-decryption.sh +++ b/test/T359-inline-pgp-decryption.sh @@ -43,7 +43,7 @@ expected=' }, "id": "XXXXX", "match": true, - "tags": ["inbox", "unread"], + "tags": ["encrypted", "inbox", "unread"], "timestamp": 946728000 }, []]]]' @@ -74,7 +74,7 @@ expected=' }, "id": "XXXXX", "match": false, - "tags": ["inbox", "unread"], + "tags": ["encrypted", "inbox", "unread"], "timestamp": 946728000 }, "reply-headers": { -- 2.15.1