From 4fb66d908a7a76b6905187858e3cbe52e434511b Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sat, 2 Mar 2013 21:55:21 +0200 Subject: [PATCH] [RFC PATCH 3/3] cli: support Mail-Followup-To: in notmuch reply --- 1f/8c9e2afadd66bb1ec665397ffc13865030f1bc | 127 ++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 1f/8c9e2afadd66bb1ec665397ffc13865030f1bc diff --git a/1f/8c9e2afadd66bb1ec665397ffc13865030f1bc b/1f/8c9e2afadd66bb1ec665397ffc13865030f1bc new file mode 100644 index 000000000..b22f56ab9 --- /dev/null +++ b/1f/8c9e2afadd66bb1ec665397ffc13865030f1bc @@ -0,0 +1,127 @@ +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 E52F1429E26 + for ; Sat, 2 Mar 2013 11:55:35 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +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 cJpyFp+iiec2 for ; + Sat, 2 Mar 2013 11:55:34 -0800 (PST) +Received: from mail-la0-f53.google.com (mail-la0-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 32049431FC3 + for ; Sat, 2 Mar 2013 11:55:30 -0800 (PST) +Received: by mail-la0-f53.google.com with SMTP id fr10so3958347lab.12 + for ; Sat, 02 Mar 2013 11:55:28 -0800 (PST) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to + :references:in-reply-to:references:x-gm-message-state; + bh=m0fw6oVS9PsyQrii0F84pm4AVAOK93SPofxcXyDBZtE=; + b=BdtLWbgriCinl5Yr66N7hdjE6XBzgFLqCqG1NOKvT+8X2G7TZ++hKt4ik48vvQFu7d + Lm8JFkp05BN6TrMgAS8L+RgH6ZWg8n/nkFmiVUspeb6y57aJaLXiAPf+3tPlTSBD41Ei + YDxltBF1wZwLvtBLfsQ6vXYoq4ydJFpWGRdbEUcND3wEdrGxgIAGvn1P08jvTXygza0T + R7vC69k5EiKA7VWT6gwtAW0bVJNrF3HsTS1XZNfO+O7OjMX4ajXHkC7pMSl2QBGk3EyD + hNIHE2IPZvCHf2zq6PqtKrOJj/3SCSCfuElVZFjbvI6v+H7yOavoHQmBGqpO5XfC6RWI + Zilg== +X-Received: by 10.152.46.17 with SMTP id r17mr13047373lam.47.1362254128497; + Sat, 02 Mar 2013 11:55:28 -0800 (PST) +Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi. + [80.223.81.27]) + by mx.google.com with ESMTPS id ng6sm8940635lab.2.2013.03.02.11.55.26 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sat, 02 Mar 2013 11:55:27 -0800 (PST) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [RFC PATCH 3/3] cli: support Mail-Followup-To: in notmuch reply +Date: Sat, 2 Mar 2013 21:55:21 +0200 +Message-Id: + +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: + <5eaa3acc22ee5513bdce5ab931b7a79ade880e06.1362254104.git.jani@nikula.org> +References: + <5eaa3acc22ee5513bdce5ab931b7a79ade880e06.1362254104.git.jani@nikula.org> +In-Reply-To: + <5eaa3acc22ee5513bdce5ab931b7a79ade880e06.1362254104.git.jani@nikula.org> +References: + <5eaa3acc22ee5513bdce5ab931b7a79ade880e06.1362254104.git.jani@nikula.org> +X-Gm-Message-State: + ALoCoQnENX3peeFiDoDAWR6l302DpC0wStKKHdWJfHPtba0plNfof/PUqJ1B3oPDOPsb+kAAfZrm +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: Sat, 02 Mar 2013 19:55:36 -0000 + +Use Mail-Followup-To header to determine recipients according to +http://cr.yp.to/proto/replyto.html if configured and present in the +message being replied to. +--- + notmuch-reply.c | 25 +++++++++++++++++++++++-- + 1 file changed, 23 insertions(+), 2 deletions(-) + +diff --git a/notmuch-reply.c b/notmuch-reply.c +index 22c58ff..604691a 100644 +--- a/notmuch-reply.c ++++ b/notmuch-reply.c +@@ -324,6 +324,7 @@ add_recipients_from_message (GMimeMessage *reply, + { "bcc", NULL, GMIME_RECIPIENT_TYPE_BCC } + }; + const char *from_addr = NULL; ++ const char *recipients; + unsigned int i; + unsigned int n = 0; + +@@ -343,9 +344,29 @@ add_recipients_from_message (GMimeMessage *reply, + reply_to_map[0].fallback = NULL; + } + +- for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) { +- const char *recipients; ++ /* Use Mail-Followup-To header to determine recipients according ++ * to http://cr.yp.to/proto/replyto.html if configured and present ++ * in the message being replied to. ++ */ ++ if (reply_all && notmuch_config_get_reply_honor_followup_to (config)) { ++ recipients = notmuch_message_get_header (message, "mail-followup-to"); ++ if (recipients && *recipients) { ++ n = scan_address_string (recipients, config, reply, ++ GMIME_RECIPIENT_TYPE_TO, &from_addr); ++ if (n) { ++ /* Same rationale as in the loop below. */ ++ reply = NULL; ++ ++ /* From address and some recipients are enough, bail out. */ ++ if (from_addr) ++ return from_addr; ++ ++ /* Else need to find from address in other headers. */ ++ } ++ } ++ } + ++ for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) { + recipients = notmuch_message_get_header (message, + reply_to_map[i].header); + if ((recipients == NULL || recipients[0] == '\0') && reply_to_map[i].fallback) +-- +1.7.10.4 + -- 2.26.2