From c479f251a2083020f4a3e8dc3b2cb90ec8b94aea Mon Sep 17 00:00:00 2001 From: "Jan N. Klug" Date: Mon, 26 Jan 2015 12:04:48 +0100 Subject: [PATCH] [PATCH] Add support for missing Messsage-ID header --- 14/bd4ef9528e3f0186f7d1fe40de5eecbc192e4c | 95 +++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 14/bd4ef9528e3f0186f7d1fe40de5eecbc192e4c diff --git a/14/bd4ef9528e3f0186f7d1fe40de5eecbc192e4c b/14/bd4ef9528e3f0186f7d1fe40de5eecbc192e4c new file mode 100644 index 000000000..acf0264b8 --- /dev/null +++ b/14/bd4ef9528e3f0186f7d1fe40de5eecbc192e4c @@ -0,0 +1,95 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 9F33B431FBD + for ; Mon, 26 Jan 2015 03:04:56 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.138 +X-Spam-Level: +X-Spam-Status: No, score=0.138 tagged_above=-999 required=5 + tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_MED=-2.3] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id XP2464hS8gsN for ; + Mon, 26 Jan 2015 03:04:53 -0800 (PST) +Received: from mx4.rz.ruhr-uni-bochum.de (mi.ruhr-uni-bochum.de + [134.147.64.53]) + by olra.theworths.org (Postfix) with SMTP id 19514431FAF + for ; Mon, 26 Jan 2015 03:04:52 -0800 (PST) +X-Queued: (qmail 9941 invoked by alias); 26 Jan 2015 11:04:52 -0000 +X-RUB-Notes: Internal +X-Queued: (qmail 9878 invoked by uid 109); 26 Jan 2015 11:04:51 -0000 +X-Qmailscanner: from 134.147.42.227 by mx4.rz.ruhr-uni-bochum.de + (envelope-from , + uid 103) with qmail-scanner-2.01 (clamdscan: 0.98.1/18526. + Clear:RC:1(134.147.42.227):. + Processed in 0.0535 secs); 26 Jan 2015 11:04:51 -0000 +Received: from mail1.mail.ruhr-uni-bochum.de (134.147.42.227) + by mx4.rz.ruhr-uni-bochum.de with SMTP; 26 Jan 2015 11:04:51 -0000 +Received: from localhost (mobil-13.rubion.ruhr-uni-bochum.de [134.147.65.233]) + by mail1.mail.ruhr-uni-bochum.de (Postfix) with ESMTPSA id 26923200D9 + for ; Mon, 26 Jan 2015 12:04:50 +0100 (CET) +From: "Jan N. Klug" +To: notmuch@notmuchmail.org +Subject: [PATCH] Add support for missing Messsage-ID header +Date: Mon, 26 Jan 2015 12:04:48 +0100 +Message-Id: <1422270288-6089-1-git-send-email-jan.n.klug@rub.de> +X-Mailer: git-send-email 2.1.4 +X-Virus-Scanned: clamav-milter 0.98.5 at mail1.mail.ruhr-uni-bochum.de +X-Virus-Status: Clean +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Mon, 26 Jan 2015 11:04:56 -0000 + +--- + contrib/notmuch-mutt/notmuch-mutt | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmuch-mutt +index 4969e4b..b9882fd 100755 +--- a/contrib/notmuch-mutt/notmuch-mutt ++++ b/contrib/notmuch-mutt/notmuch-mutt +@@ -18,7 +18,7 @@ use Mail::Box::Maildir; + use Pod::Usage; + use String::ShellQuote; + use Term::ReadLine; +- ++use Digest::SHA qw (sha1_hex); + + my $xdg_cache_dir = "$ENV{HOME}/.cache"; + $xdg_cache_dir = $ENV{XDG_CACHE_HOME} if $ENV{XDG_CACHE_HOME}; +@@ -75,10 +75,14 @@ sub prompt($$) { + } + + sub get_message_id() { +- my $mail = Mail::Internet->new(\*STDIN); +- my $mid = $mail->head->get("message-id") or return undef; +- $mid =~ /^<(.*)>$/; # get message-id value +- return $1; ++ my $mail = Mail::Internet->new(\*STDIN, Modify => 0); ++ my $mid = $mail->head->get("message-id"); ++ if (defined $mid) { # get message-id value ++ $mid = $1 if ($mid =~ /^<(.*)>$/); ++ } else { # generate synthetic message-id ++ $mid = "notmuch-sha1-".sha1_hex($mail->as_string()); ++ } ++ return $mid; + } + + sub search_action($$$@) { +-- +2.1.4 + -- 2.26.2