From 2ff2d763aa03ee3f577a628308a5676fa01cbaa9 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sun, 4 Mar 2012 10:25:38 +0200 Subject: [PATCH] [PATCH] emacs: fix MML quoting in replies --- a1/d48298ac66e37a3695fa26f57fdb4d288ea1d4 | 114 ++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 a1/d48298ac66e37a3695fa26f57fdb4d288ea1d4 diff --git a/a1/d48298ac66e37a3695fa26f57fdb4d288ea1d4 b/a1/d48298ac66e37a3695fa26f57fdb4d288ea1d4 new file mode 100644 index 000000000..edb053332 --- /dev/null +++ b/a1/d48298ac66e37a3695fa26f57fdb4d288ea1d4 @@ -0,0 +1,114 @@ +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 D87DF431FAF + for ; Sun, 4 Mar 2012 00:25:45 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 7TBKAv37peMJ for ; + Sun, 4 Mar 2012 00:25:45 -0800 (PST) +Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com + [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id EC042431FAE + for ; Sun, 4 Mar 2012 00:25:44 -0800 (PST) +Received: by lahc1 with SMTP id c1so3802307lah.26 + for ; Sun, 04 Mar 2012 00:25:42 -0800 (PST) +Received-SPF: pass (google.com: domain of jani@nikula.org designates + 10.112.44.225 as permitted sender) client-ip=10.112.44.225; +Authentication-Results: mr.google.com; + spf=pass (google.com: domain of jani@nikula.org + designates 10.112.44.225 as permitted sender) + smtp.mail=jani@nikula.org +Received: from mr.google.com ([10.112.44.225]) + by 10.112.44.225 with SMTP id h1mr7629690lbm.34.1330849542073 (num_hops + = 1); Sun, 04 Mar 2012 00:25:42 -0800 (PST) +MIME-Version: 1.0 +Received: by 10.112.44.225 with SMTP id h1mr6321557lbm.34.1330849541999; + Sun, 04 Mar 2012 00:25:41 -0800 (PST) +Received: from localhost (dsl-hkibrasgw4-fe50f800-253.dhcp.inet.fi. + [84.248.80.253]) + by mx.google.com with ESMTPS id k4sm17000996lbw.10.2012.03.04.00.25.39 + (version=SSLv3 cipher=OTHER); Sun, 04 Mar 2012 00:25:40 -0800 (PST) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH] emacs: fix MML quoting in replies +Date: Sun, 4 Mar 2012 10:25:38 +0200 +Message-Id: <1330849538-24558-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 1.7.5.4 +In-Reply-To: <87fwdptbir.fsf@dehydrator.spatula.rdu.redhat.com> +References: <87fwdptbir.fsf@dehydrator.spatula.rdu.redhat.com> +X-Gm-Message-State: + ALoCoQlRL9vUDPWI+xdOiwaE6CDp+OiT4/v+jQ0+D/kETzO00E6yzRVsd7MXu2oLcX+45mCsmlmm +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, 04 Mar 2012 08:25:46 -0000 + +The reply MML quoting added in commit ae438cc unintentionally MML +quotes also the signature/encryption MML tags added via +message-setup-hook, causing the reply not to be signed/encrypted. + +MML quote just the original message in the temp buffer before +inserting it to the message buffer, to not interfere with message mode +hooks or message construction in general. + +See [1] and [2] for bug reports. + +Thanks to Tim Bielawa for testing. + +[1] id:"87hay78x6l.fsf@wyzanski.jamesvasile.com" +[2] id:"1330812262-28272-1-git-send-email-tbielawa@redhat.com". + +Signed-off-by: Jani Nikula +--- + emacs/notmuch-mua.el | 10 ++++------ + 1 files changed, 4 insertions(+), 6 deletions(-) + +diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el +index 4be7c13..13244eb 100644 +--- a/emacs/notmuch-mua.el ++++ b/emacs/notmuch-mua.el +@@ -95,6 +95,9 @@ list." + (goto-char (point-min)) + (setq headers (mail-header-extract))))) + (forward-line 1) ++ ;; Original message may contain (malicious) MML tags. We must ++ ;; properly quote them in the reply. ++ (mml-quote-region (point) (point-max)) + (setq body (buffer-substring (point) (point-max)))) + ;; If sender is non-nil, set the From: header to its value. + (when sender +@@ -116,12 +119,7 @@ list." + (push-mark)) + (set-buffer-modified-p nil) + +- (message-goto-body) +- ;; Original message may contain (malicious) MML tags. We must +- ;; properly quote them in the reply. Note that using `point-max' +- ;; instead of `mark' here is wrong. The buffer may include user's +- ;; signature which should not be MML-quoted. +- (mml-quote-region (point) (mark))) ++ (message-goto-body)) + + (defun notmuch-mua-forward-message () + (message-forward) +-- +1.7.5.4 + -- 2.26.2