1 Return-Path: <zack@upsilon.cc>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 46865431FD4
\r
6 for <notmuch@notmuchmail.org>; Sat, 24 Jan 2015 01:18:25 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=2.338 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 DNS_FROM_AHBL_RHSBL=2.438] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id ENn1IhqCx5NZ for <notmuch@notmuchmail.org>;
\r
17 Sat, 24 Jan 2015 01:18:22 -0800 (PST)
\r
18 Received: from upsilon.cc (upsilon.cc [178.32.142.91])
\r
19 by olra.theworths.org (Postfix) with ESMTP id C48B6431FCF
\r
20 for <notmuch@notmuchmail.org>; Sat, 24 Jan 2015 01:18:20 -0800 (PST)
\r
21 Received: from timira.takhisis.invalid (unknown [78.194.69.54])
\r
22 by upsilon.cc (Postfix) with ESMTPSA id 63AC210DBA;
\r
23 Sat, 24 Jan 2015 10:11:51 +0100 (CET)
\r
24 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=upsilon.cc; s=mail;
\r
25 t=1422090711; bh=ZLCI7TBYgnypG9MMMG8qqQU7tO2KLxFsXcmij3ogoDU=;
\r
26 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
\r
27 b=foVkgTQrC47AZuzMIqd4GynFJWAqPv1XexqtR36wfFsqX15rS/JzqHXt5zQi7NsLL
\r
28 QFrPUTWAmQ02lIbQ2ih2S5eG1gh6pdYphqczV6K04SpikKliYSh4eSEgWfhDglBesO
\r
29 Fb/HPhnbJi1KXxB0sUYm7E1eJpzXXgMJEG1C5XZM=
\r
30 Received: by timira.takhisis.invalid (Postfix, from userid 1000)
\r
31 id 41121600E1; Sat, 24 Jan 2015 10:11:50 +0100 (CET)
\r
32 From: Stefano Zacchiroli <zack@upsilon.cc>
\r
33 To: notmuch@notmuchmail.org
\r
34 Subject: [PATCH 2/3] notmuch-mutt: support for messages that lack Message-ID
\r
36 Date: Sat, 24 Jan 2015 10:11:40 +0100
\r
37 Message-Id: <1422090701-19385-3-git-send-email-zack@upsilon.cc>
\r
38 X-Mailer: git-send-email 2.1.4
\r
39 In-Reply-To: <1422090701-19385-1-git-send-email-zack@upsilon.cc>
\r
40 References: <1422090701-19385-1-git-send-email-zack@upsilon.cc>
\r
41 Cc: "Jan N. Klug" <jan.n.klug@rub.de>, Stefano Zacchiroli <zack@upsilon.cc>
\r
42 X-BeenThere: notmuch@notmuchmail.org
\r
43 X-Mailman-Version: 2.1.13
\r
45 List-Id: "Use and development of the notmuch mail system."
\r
46 <notmuch.notmuchmail.org>
\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
50 List-Post: <mailto:notmuch@notmuchmail.org>
\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
54 X-List-Received-Date: Sat, 24 Jan 2015 09:18:25 -0000
\r
56 From: "Jan N. Klug" <jan.n.klug@rub.de>
\r
58 For those messages, compute a synthetic Message-ID based on the SHA1
\r
59 of the whole message, in the same way that notmuch would do. See:
\r
60 http://git.notmuchmail.org/git/notmuch/blob/HEAD:/lib/sha1.c
\r
62 To do the above, rewrite get_message_id() to scan the current message
\r
63 line by line, incrementally computing a SHA1. As a consequence, drop
\r
64 the dependency on Mail::Internet.
\r
66 Signed-off-by: Stefano Zacchiroli <zack@upsilon.cc>
\r
68 contrib/notmuch-mutt/README | 4 ++--
\r
69 contrib/notmuch-mutt/notmuch-mutt | 23 ++++++++++++++++++-----
\r
70 2 files changed, 20 insertions(+), 7 deletions(-)
\r
72 diff --git a/contrib/notmuch-mutt/README b/contrib/notmuch-mutt/README
\r
73 index c661447..0013ed0 100644
\r
74 --- a/contrib/notmuch-mutt/README
\r
75 +++ b/contrib/notmuch-mutt/README
\r
76 @@ -33,10 +33,10 @@ Requirements
\r
78 To *run* notmuch-mutt you will need Perl with the following libraries:
\r
80 +- Digest::SHA <https://metacpan.org/release/Digest-SHA>
\r
81 + (Debian package: libdigest-sha-perl)
\r
82 - Mail::Box <https://metacpan.org/pod/Mail::Box>
\r
83 (Debian package: libmail-box-perl)
\r
84 -- Mail::Internet <https://metacpan.org/pod/Mail::Internet>
\r
85 - (Debian package: libmailtools-perl)
\r
86 - String::ShellQuote <https://metacpan.org/pod/String::ShellQuote>
\r
87 (Debian package: libstring-shellquote-perl)
\r
88 - Term::ReadLine::Gnu <https://metacpan.org/pod/Term::ReadLine::Gnu>
\r
89 diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmuch-mutt
\r
90 index 4969e4b..4d30b0b 100755
\r
91 --- a/contrib/notmuch-mutt/notmuch-mutt
\r
92 +++ b/contrib/notmuch-mutt/notmuch-mutt
\r
93 @@ -13,11 +13,11 @@ use warnings;
\r
96 use Getopt::Long qw(:config no_getopt_compat);
\r
97 -use Mail::Internet;
\r
98 use Mail::Box::Maildir;
\r
100 use String::ShellQuote;
\r
101 use Term::ReadLine;
\r
105 my $xdg_cache_dir = "$ENV{HOME}/.cache";
\r
106 @@ -75,10 +75,23 @@ sub prompt($$) {
\r
109 sub get_message_id() {
\r
110 - my $mail = Mail::Internet->new(\*STDIN);
\r
111 - my $mid = $mail->head->get("message-id") or return undef;
\r
112 - $mid =~ /^<(.*)>$/; # get message-id value
\r
115 + my $sha = Digest::SHA->new(1); # SHA1 hashing
\r
117 + while(<STDIN>) { # scan message line by line, looking for mid
\r
118 + if ($_ =~ /^Message-ID:\s*<(.*)>$/i) {
\r
120 + last; # message-id found, abort scan
\r
122 + $sha->add($_); # update hash
\r
125 + # Generate message-id from hash if none was found, in the same way
\r
126 + # that notmuch would do.
\r
127 + # See: http://git.notmuchmail.org/git/notmuch/blob/HEAD:/lib/sha1.c
\r
128 + $mid ||= "notmuch-sha1-".$sha->hexdigest;
\r
133 sub search_action($$$@) {
\r