From e50aa159bec993675a1964416c81c30b9ed41f04 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sun, 25 Mar 2012 13:22:24 +0100 Subject: [PATCH] Re: [BUG/PATCH 2/2] emacs: Fix replying from alternate addresses --- 74/b51998a8097e00e144eea96694ae6465c82329 | 141 ++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 74/b51998a8097e00e144eea96694ae6465c82329 diff --git a/74/b51998a8097e00e144eea96694ae6465c82329 b/74/b51998a8097e00e144eea96694ae6465c82329 new file mode 100644 index 000000000..9cbb11e44 --- /dev/null +++ b/74/b51998a8097e00e144eea96694ae6465c82329 @@ -0,0 +1,141 @@ +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 29C69431FAF + for ; Sun, 25 Mar 2012 05:22:21 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, 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 0Wd3idEp3Hq1 for ; + Sun, 25 Mar 2012 05:22:20 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 35CA0431FAE + for ; Sun, 25 Mar 2012 05:22:20 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1SBmSa-0000P1-3G; Sun, 25 Mar 2012 13:22:16 +0100 +Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] + helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1SBmSZ-0002Vv-M4; Sun, 25 Mar 2012 13:22:11 +0100 +From: Mark Walters +To: Adam Wolfe Gordon , notmuch@notmuchmail.org +Subject: Re: [BUG/PATCH 2/2] emacs: Fix replying from alternate addresses +In-Reply-To: <1332635232-15269-3-git-send-email-awg+notmuch@xvx.ca> +References: <1332635232-15269-1-git-send-email-awg+notmuch@xvx.ca> + <1332635232-15269-3-git-send-email-awg+notmuch@xvx.ca>User-Agent: + Notmuch/0.12+65~g8bf1842 (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-pc-linux-gnu) +Date: Sun, 25 Mar 2012 13:22:24 +0100 +Message-ID: <878vio50qn.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 94.192.233.223 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: d1215d7abb7f688dbb3968b66ae41d5e (of first 20000 bytes) +X-SpamAssassin-Score: -1.8 +X-SpamAssassin-SpamBar: - +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -1.8 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 0.5 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is 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: Sun, 25 Mar 2012 12:22:21 -0000 + +Adam Wolfe Gordon writes: +> The bug was that notmuch-mua-mail used `mail-header` to check whether +> it was passed a "From" header. The implementation of `mail-header` +> must try to compare symbols instead of strings when looking for +> headers, as it was returning nil when a From header was present. This +> is probably because the mail functions construct headers as alists +> with symbols for the header names, while our code uses strings for the +> header names. +> +> Since we don't use `mail-header` anywhere else, and `message-mail` is +> perfectly happy to accept string header names, the fix is just to use +> `assoc` to look for the From header, so that the strings get compared +> properly. + +I can confirm that everything works as expected with this fix. + +Best wishes + +Mark +> --- +> emacs/notmuch-mua.el | 4 ++-- +> test/emacs | 1 - +> 2 files changed, 2 insertions(+), 3 deletions(-) +> +> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el +> index 6aae3a0..9805d79 100644 +> --- a/emacs/notmuch-mua.el +> +++ b/emacs/notmuch-mua.el +> @@ -187,7 +187,7 @@ OTHER-ARGS are passed through to `message-mail'." +> (when (not (string= "" user-agent)) +> (push (cons "User-Agent" user-agent) other-headers)))) +> +> - (unless (mail-header 'From other-headers) +> + (unless (assoc "From" other-headers) +> (push (cons "From" (concat +> (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers)) +> +> @@ -250,7 +250,7 @@ the From: address first." +> (interactive "P") +> (let ((other-headers +> (when (or prompt-for-sender notmuch-always-prompt-for-sender) +> - (list (cons 'From (notmuch-mua-prompt-for-sender)))))) +> + (list (cons "From" (notmuch-mua-prompt-for-sender)))))) +> (notmuch-mua-mail nil nil other-headers))) +> +> (defun notmuch-mua-new-forward-message (&optional prompt-for-sender) +> diff --git a/test/emacs b/test/emacs +> index fa5d706..08db1ee 100755 +> --- a/test/emacs +> +++ b/test/emacs +> @@ -275,7 +275,6 @@ EOF +> test_expect_equal_file OUTPUT EXPECTED +> +> test_begin_subtest "Reply from alternate address within emacs" +> -test_subtest_known_broken +> add_message '[from]="Sender "' \ +> [to]=test_suite_other@notmuchmail.org \ +> [subject]=notmuch-reply-test \ +> -- +> 1.7.5.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2