This patch adds the tag "signed" to messages with any multipart/signed
parts, and the tag "encrypted" to messages with any
multipart/encrypted parts. This only occurs when messages are indexed
during notmuch new, so a database rebuild is required to have old
messages tagged.
---
lib/index.cc | 6 ++++++
test/crypto | 16 ++++++++--------
.../emacs.expected-output/notmuch-hello-view-inbox | 6 +++---
.../emacs.expected-output/notmuch-search-tag-inbox | 6 +++---
.../notmuch-show-thread-maildir-storage | 8 ++++----
test/multipart | 4 ++--
test/search | 6 +++---
test/search-output | 2 ++
8 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/lib/index.cc b/lib/index.cc
index bdfb8ed..e8e9922 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -325,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. */
diff --git a/test/crypto b/test/crypto
index 3b0f381..c5abcc3 100755
--- a/test/crypto
+++ b/test/crypto
@@ -46,7 +46,7 @@ expected='[[[{"id": "XXXXX",
"filename": "YYYYY",
"timestamp": 946728000,
"date_relative": "2000-01-01",
- "tags": ["inbox"],
+ "tags": ["inbox","signed"],
"headers": {"Subject": "test signed message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
@@ -76,7 +76,7 @@ expected='[[[{"id": "XXXXX",
"filename": "YYYYY",
"timestamp": 946728000,
"date_relative": "2000-01-01",
- "tags": ["inbox"],
+ "tags": ["inbox","signed"],
"headers": {"Subject": "test signed message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
@@ -106,7 +106,7 @@ expected='[[[{"id": "XXXXX",
"filename": "YYYYY",
"timestamp": 946728000,
"date_relative": "2000-01-01",
- "tags": ["inbox"],
+ "tags": ["inbox","signed"],
"headers": {"Subject": "test signed message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
@@ -141,7 +141,7 @@ output=$(notmuch show --format=text --decrypt subject:"test
encrypted message 00
| sed -e 's|"created": [1234567890]*|"created": 946728000|')
expected='message{ id:XXXXX depth:0 match:1 filename:XXXXX
header{
-Notmuch Test Suite <test_suite at notmuchmail.org> (2000-01-01) (inbox)
+Notmuch Test Suite <test_suite at notmuchmail.org> (2000-01-01) (encrypted
inbox)
Subject: test encrypted message 001
From: Notmuch Test Suite <test_suite at notmuchmail.org>
To: test_suite at notmuchmail.org
@@ -172,7 +172,7 @@ expected='[[[{"id": "XXXXX",
"filename": "YYYYY",
"timestamp": 946728000,
"date_relative": "2000-01-01",
- "tags": ["inbox"],
+ "tags": ["encrypted","inbox"],
"headers": {"Subject": "test encrypted message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
@@ -223,7 +223,7 @@ expected='[[[{"id": "XXXXX",
"filename": "YYYYY",
"timestamp": 946728000,
"date_relative": "2000-01-01",
- "tags": ["inbox"],
+ "tags": ["encrypted","inbox"],
"headers": {"Subject": "test encrypted message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
@@ -258,7 +258,7 @@ expected='[[[{"id": "XXXXX",
"filename": "YYYYY",
"timestamp": 946728000,
"date_relative": "2000-01-01",
- "tags": ["inbox"],
+ "tags": ["encrypted","inbox"],
"headers": {"Subject": "test encrypted message 002",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
@@ -309,7 +309,7 @@ expected='[[[{"id": "XXXXX",
"filename": "YYYYY",
"timestamp": 946728000,
"date_relative": "2000-01-01",
- "tags": ["inbox"],
+ "tags": ["inbox","signed"],
"headers": {"Subject": "test signed message 001",
"From": "Notmuch Test Suite <test_suite at notmuchmail.org>",
"To": "test_suite at notmuchmail.org",
diff --git a/test/emacs.expected-output/notmuch-hello-view-inbox
b/test/emacs.expected-output/notmuch-hello-view-inbox
index 6472c46..894ae5f 100644
--- a/test/emacs.expected-output/notmuch-hello-view-inbox
+++ b/test/emacs.expected-output/notmuch-hello-view-inbox
@@ -1,16 +1,16 @@
2009-11-17 [5/5] Mikhail Gusarov, Carl Worth, Keith Packard [notmuch]
[PATCH 1/2] Close message file after parsing message headers (inbox unread)
- 2009-11-17 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard,
Carl Worth [notmuch] Working with Maildir storage? (inbox unread)
+ 2009-11-17 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard,
Carl Worth [notmuch] Working with Maildir storage? (inbox signed unread)
2009-11-17 [2/2] Alex Botero-Lowry, Carl Worth [notmuch] preliminary
FreeBSD support (attachment inbox unread)
2009-11-17 [1/1] Mikhail Gusarov [notmuch] [PATCH] Handle rename of
message file (inbox unread)
2009-11-17 [2/2] Keith Packard, Carl Worth [notmuch] [PATCH] Make
notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox
unread)
2009-11-17 [2/2] Jan Janak, Carl Worth [notmuch] [PATCH] Older
versions of install do not support -C. (inbox unread)
2009-11-17 [3/3] Jan Janak, Carl Worth [notmuch] What a great idea!
(inbox unread)
2009-11-17 [3/3] Israel Herraiz, Keith Packard, Carl Worth [notmuch] New
to the list (inbox unread)
- 2009-11-17 [3/3] Adrian Perez de Castro, Keith Packard, Carl Worth
[notmuch] Introducing myself (inbox unread)
+ 2009-11-17 [3/3] Adrian Perez de Castro, Keith Packard, Carl Worth
[notmuch] Introducing myself (inbox signed unread)
2009-11-17 [3/3] Aron Griffis, Keith Packard, Carl Worth [notmuch]
archive (inbox unread)
2009-11-17 [2/2] Ingmar Vanhassel, Carl Worth [notmuch] [PATCH] Typsos
(inbox unread)
2009-11-18 [2/2] Alex Botero-Lowry, Carl Worth [notmuch] [PATCH] Error
out if no query is supplied to search instead of going into an infinite loop
(attachment inbox unread)
- 2009-11-18 [2/2] Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to
stderr? (attachment inbox unread)
+ 2009-11-18 [2/2] Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to
stderr? (attachment inbox signed unread)
2009-11-18 [1/1] Stewart Smith [notmuch] [PATCH] Fix linking with
gcc to use g++ to link in C++ libs. (inbox unread)
2009-11-18 [1/1] Stewart Smith [notmuch] [PATCH 2/2] Read mail
directory in inode number order (inbox unread)
2009-11-18 [1/1] Stewart Smith [notmuch] [PATCH] count_files: sort
directory in inode order before statting (inbox unread)
diff --git a/test/emacs.expected-output/notmuch-search-tag-inbox
b/test/emacs.expected-output/notmuch-search-tag-inbox
index 2168159..9456ccf 100644
--- a/test/emacs.expected-output/notmuch-search-tag-inbox
+++ b/test/emacs.expected-output/notmuch-search-tag-inbox
@@ -1,13 +1,13 @@
2009-11-18 [1/1] Chris Wilson [notmuch] [PATCH 1/2] Makefile:
evaluate pkg-config once (inbox unread)
2009-11-18 [2/2] Alex Botero-Lowry, Carl Worth [notmuch] [PATCH] Error
out if no query is supplied to search instead of going into an infinite loop
(attachment inbox unread)
2009-11-18 [2/2] Ingmar Vanhassel, Carl Worth [notmuch] [PATCH] Typsos
(inbox unread)
- 2009-11-18 [3/3] Adrian Perez de Castro, Keith Packard, Carl Worth
[notmuch] Introducing myself (inbox unread)
+ 2009-11-18 [3/3] Adrian Perez de Castro, Keith Packard, Carl Worth
[notmuch] Introducing myself (inbox signed unread)
2009-11-18 [3/3] Israel Herraiz, Keith Packard, Carl Worth [notmuch] New
to the list (inbox unread)
2009-11-18 [3/3] Jan Janak, Carl Worth [notmuch] What a great idea!
(inbox unread)
2009-11-18 [2/2] Jan Janak, Carl Worth [notmuch] [PATCH] Older
versions of install do not support -C. (inbox unread)
2009-11-18 [3/3] Aron Griffis, Keith Packard, Carl Worth [notmuch]
archive (inbox unread)
2009-11-18 [2/2] Keith Packard, Carl Worth [notmuch] [PATCH] Make
notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox
unread)
- 2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard,
Carl Worth [notmuch] Working with Maildir storage? (inbox unread)
+ 2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard,
Carl Worth [notmuch] Working with Maildir storage? (inbox signed unread)
2009-11-18 [5/5] Mikhail Gusarov, Carl Worth, Keith Packard [notmuch]
[PATCH 1/2] Close message file after parsing message headers (inbox unread)
2009-11-18 [2/2] Keith Packard, Alexander Botero-Lowry [notmuch]
[PATCH] Create a default notmuch-show-hook that highlights URLs and uses
word-wrap (inbox unread)
2009-11-18 [1/1] Alexander Botero-Lowry [notmuch] request for pull (inbox
unread)
@@ -17,7 +17,7 @@
2009-11-18 [1/1] Stewart Smith [notmuch] [PATCH] count_files: sort
directory in inode order before statting (inbox unread)
2009-11-18 [1/1] Stewart Smith [notmuch] [PATCH 2/2] Read mail
directory in inode number order (inbox unread)
2009-11-18 [1/1] Stewart Smith [notmuch] [PATCH] Fix linking with
gcc to use g++ to link in C++ libs. (inbox unread)
- 2009-11-18 [2/2] Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to
stderr? (attachment inbox unread)
+ 2009-11-18 [2/2] Lars Kellogg-Stedman [notmuch] "notmuch help" outputs to
stderr? (attachment inbox signed unread)
2009-11-17 [1/1] Mikhail Gusarov [notmuch] [PATCH] Handle rename of
message file (inbox unread)
2009-11-17 [2/2] Alex Botero-Lowry, Carl Worth [notmuch] preliminary
FreeBSD support (attachment inbox unread)
End of search results.
diff --git a/test/emacs.expected-output/notmuch-show-thread-maildir-storage
b/test/emacs.expected-output/notmuch-show-thread-maildir-storage
index 034d3d4..241b5b7 100644
--- a/test/emacs.expected-output/notmuch-show-thread-maildir-storage
+++ b/test/emacs.expected-output/notmuch-show-thread-maildir-storage
@@ -1,4 +1,4 @@
-Lars Kellogg-Stedman <lars at seas.harvard.edu> (2009-11-17) (inbox)
+Lars Kellogg-Stedman <lars at seas.harvard.edu> (2009-11-17) (inbox signed)
Subject: [notmuch] Working with Maildir storage?
To: notmuch at notmuchmail.org
Date: Tue, 17 Nov 2009 14:00:54 -0500
@@ -39,7 +39,7 @@ _______________________________________________
notmuch mailing list
notmuch at notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch
- Mikhail Gusarov <dottedmag at dottedmag.net> (2009-11-17) (inbox unread)
+ Mikhail Gusarov <dottedmag at dottedmag.net> (2009-11-17) (inbox signed
unread)
Subject: Re: [notmuch] Working with Maildir storage?
To: notmuch at notmuchmail.org
Date: Wed, 18 Nov 2009 01:02:38 +0600
@@ -68,7 +68,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch
notmuch mailing list
notmuch at notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch
- Lars Kellogg-Stedman <lars at seas.harvard.edu> (2009-11-17) (inbox unread)
+ Lars Kellogg-Stedman <lars at seas.harvard.edu> (2009-11-17) (inbox signed
unread)
Subject: Re: [notmuch] Working with Maildir storage?
To: Mikhail Gusarov <dottedmag at dottedmag.net>
Cc: notmuch at notmuchmail.org
@@ -151,7 +151,7 @@ http://notmuchmail.org/mailman/listinfo/notmuch
-keith
- Lars Kellogg-Stedman <lars at seas.harvard.edu> (2009-11-18) (inbox unread)
+ Lars Kellogg-Stedman <lars at seas.harvard.edu> (2009-11-18) (inbox signed
unread)
Subject: Re: [notmuch] Working with Maildir storage?
To: Keith Packard <keithp at keithp.com>
Cc: notmuch at notmuchmail.org
diff --git a/test/multipart b/test/multipart
index 80da0b4..d712853 100755
--- a/test/multipart
+++ b/test/multipart
@@ -63,7 +63,7 @@ output=$(notmuch show --format=text --part=0
'id:87liy5ap00.fsf at yoom.home.cworth
test_expect_equal "$output" \
"message{ id:87liy5ap00.fsf at yoom.home.cworth.org depth:0 match:1
filename:${MAIL_DIR}/multipart
header{
-Carl Worth <cworth at cworth.org> (2001-01-05) (attachment inbox unread)
+Carl Worth <cworth at cworth.org> (2001-01-05) (attachment inbox signed unread)
Subject: Multipart message
From: Carl Worth <cworth at cworth.org>
To: cworth at cworth.org
@@ -186,7 +186,7 @@ test_expect_success \
test_begin_subtest "--format=json --part=0, full message"
output=$(notmuch show --format=json --part=0 'id:87liy5ap00.fsf at
yoom.home.cworth.org')
test_expect_equal "$output" \
-'{"id": "87liy5ap00.fsf at yoom.home.cworth.org", "match": true, "filename":
"'"${MAIL_DIR}/multipart"'", "timestamp": 978709437, "date_relative":
"2001-01-05", "tags": ["attachment","inbox","unread"], "headers": {"Subject":
"Multipart message", "From": "Carl Worth <cworth at cworth.org>", "To": "cworth
at cworth.org", "Cc": "", "Bcc": "", "Date": "Tue, 05 Jan 2001 15:43:57
-0000"}, "body": [{"id": 1, "content-type": "multipart/signed", "content":
[{"id": 2, "content-type": "multipart/mixed", "content": [{"id": 3,
"content-type": "message/rfc822", "content": [{"id": 4, "content-type":
"text/html"}]}, {"id": 5, "content-type": "text/plain", "filename":
"attachment", "content": "This is a text attachment.\n"}, {"id": 6,
"content-type": "text/plain", "content": "And this message is
signed.\n\n-Carl\n"}]}, {"id": 7, "content-type":
"application/pgp-signature"}]}]}'
+'{"id": "87liy5ap00.fsf at yoom.home.cworth.org", "match": true, "filename":
"'"${MAIL_DIR}/multipart"'", "timestamp": 978709437, "date_relative":
"2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers":
{"Subject": "Multipart message", "From": "Carl Worth <cworth at cworth.org>",
"To": "cworth at cworth.org", "Cc": "", "Bcc": "", "Date": "Tue, 05 Jan 2001
15:43:57 -0000"}, "body": [{"id": 1, "content-type": "multipart/signed",
"content": [{"id": 2, "content-type": "multipart/mixed", "content": [{"id": 3,
"content-type": "message/rfc822", "content": [{"id": 4, "content-type":
"text/html"}]}, {"id": 5, "content-type": "text/plain", "filename":
"attachment", "content": "This is a text attachment.\n"}, {"id": 6,
"content-type": "text/plain", "content": "And this message is
signed.\n\n-Carl\n"}]}, {"id": 7, "content-type":
"application/pgp-signature"}]}]}'
test_begin_subtest "--format=json --part=1, message body"
output=$(notmuch show --format=json --part=1 'id:87liy5ap00.fsf at
yoom.home.cworth.org')
diff --git a/test/search b/test/search
index b180c7f..d2579df 100755
--- a/test/search
+++ b/test/search
@@ -78,13 +78,13 @@ output=$(notmuch search '*' | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2009-11-18 [1/1] Chris Wilson;
[notmuch] [PATCH 1/2] Makefile: evaluate pkg-config once (inbox unread)
thread:XXX 2009-11-18 [2/2] Alex Botero-Lowry, Carl Worth; [notmuch] [PATCH]
Error out if no query is supplied to search instead of going into an infinite
loop (attachment inbox unread)
thread:XXX 2009-11-18 [2/2] Ingmar Vanhassel, Carl Worth; [notmuch] [PATCH]
Typsos (inbox unread)
-thread:XXX 2009-11-18 [3/3] Adrian Perez de Castro, Keith Packard, Carl
Worth; [notmuch] Introducing myself (inbox unread)
+thread:XXX 2009-11-18 [3/3] Adrian Perez de Castro, Keith Packard, Carl
Worth; [notmuch] Introducing myself (inbox signed unread)
thread:XXX 2009-11-18 [3/3] Israel Herraiz, Keith Packard, Carl Worth;
[notmuch] New to the list (inbox unread)
thread:XXX 2009-11-18 [3/3] Jan Janak, Carl Worth; [notmuch] What a great
idea! (inbox unread)
thread:XXX 2009-11-18 [2/2] Jan Janak, Carl Worth; [notmuch] [PATCH] Older
versions of install do not support -C. (inbox unread)
thread:XXX 2009-11-18 [3/3] Aron Griffis, Keith Packard, Carl Worth;
[notmuch] archive (inbox unread)
thread:XXX 2009-11-18 [2/2] Keith Packard, Carl Worth; [notmuch] [PATCH]
Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (inbox
unread)
-thread:XXX 2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith
Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox unread)
+thread:XXX 2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith
Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed
unread)
thread:XXX 2009-11-18 [5/5] Mikhail Gusarov, Carl Worth, Keith Packard;
[notmuch] [PATCH 1/2] Close message file after parsing message headers (inbox
unread)
thread:XXX 2009-11-18 [2/2] Keith Packard, Alexander Botero-Lowry; [notmuch]
[PATCH] Create a default notmuch-show-hook that highlights URLs and uses
word-wrap (inbox unread)
thread:XXX 2009-11-18 [1/1] Alexander Botero-Lowry; [notmuch] request for
pull (inbox unread)
@@ -94,7 +94,7 @@ thread:XXX 2009-11-18 [1/1] Jan Janak; [notmuch] [PATCH]
notmuch new: Support
thread:XXX 2009-11-18 [1/1] Stewart Smith; [notmuch] [PATCH] count_files:
sort directory in inode order before statting (inbox unread)
thread:XXX 2009-11-18 [1/1] Stewart Smith; [notmuch] [PATCH 2/2] Read mail
directory in inode number order (inbox unread)
thread:XXX 2009-11-18 [1/1] Stewart Smith; [notmuch] [PATCH] Fix linking
with gcc to use g++ to link in C++ libs. (inbox unread)
-thread:XXX 2009-11-18 [2/2] Lars Kellogg-Stedman; [notmuch] \"notmuch help\"
outputs to stderr? (attachment inbox unread)
+thread:XXX 2009-11-18 [2/2] Lars Kellogg-Stedman; [notmuch] \"notmuch help\"
outputs to stderr? (attachment inbox signed unread)
thread:XXX 2009-11-17 [1/1] Mikhail Gusarov; [notmuch] [PATCH] Handle rename
of message file (inbox unread)
thread:XXX 2009-11-17 [2/2] Alex Botero-Lowry, Carl Worth; [notmuch]
preliminary FreeBSD support (attachment inbox unread)
thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; body search (inbox unread)
diff --git a/test/search-output b/test/search-output
index b414993..55dbc81 100755
--- a/test/search-output
+++ b/test/search-output
@@ -270,12 +270,14 @@ test_begin_subtest "notmuch search --output=tags"
output=$(notmuch search --output=tags '*')
test_expect_equal "$output" "attachment
inbox
+signed
unread"
test_begin_subtest "notmuch search --format=json --output=tags"
output=$(notmuch search --format=json --output=tags '*')
test_expect_equal "$output" '["attachment",
"inbox",
+"signed",
"unread"]'
test_done
--
1.7.4.4