[RFC PATCH 3/3] cli: support Mail-Followup-To: in notmuch reply
authorJani Nikula <jani@nikula.org>
Sat, 2 Mar 2013 19:55:21 +0000 (21:55 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:53:50 +0000 (09:53 -0800)
1f/8c9e2afadd66bb1ec665397ffc13865030f1bc [new file with mode: 0644]

diff --git a/1f/8c9e2afadd66bb1ec665397ffc13865030f1bc b/1f/8c9e2afadd66bb1ec665397ffc13865030f1bc
new file mode 100644 (file)
index 0000000..b22f56a
--- /dev/null
@@ -0,0 +1,127 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id E52F1429E26\r
+       for <notmuch@notmuchmail.org>; Sat,  2 Mar 2013 11:55:35 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id cJpyFp+iiec2 for <notmuch@notmuchmail.org>;\r
+       Sat,  2 Mar 2013 11:55:34 -0800 (PST)\r
+Received: from mail-la0-f53.google.com (mail-la0-f53.google.com\r
+       [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 32049431FC3\r
+       for <notmuch@notmuchmail.org>; Sat,  2 Mar 2013 11:55:30 -0800 (PST)\r
+Received: by mail-la0-f53.google.com with SMTP id fr10so3958347lab.12\r
+       for <notmuch@notmuchmail.org>; Sat, 02 Mar 2013 11:55:28 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
+       :references:in-reply-to:references:x-gm-message-state;\r
+       bh=m0fw6oVS9PsyQrii0F84pm4AVAOK93SPofxcXyDBZtE=;\r
+       b=BdtLWbgriCinl5Yr66N7hdjE6XBzgFLqCqG1NOKvT+8X2G7TZ++hKt4ik48vvQFu7d\r
+       Lm8JFkp05BN6TrMgAS8L+RgH6ZWg8n/nkFmiVUspeb6y57aJaLXiAPf+3tPlTSBD41Ei\r
+       YDxltBF1wZwLvtBLfsQ6vXYoq4ydJFpWGRdbEUcND3wEdrGxgIAGvn1P08jvTXygza0T\r
+       R7vC69k5EiKA7VWT6gwtAW0bVJNrF3HsTS1XZNfO+O7OjMX4ajXHkC7pMSl2QBGk3EyD\r
+       hNIHE2IPZvCHf2zq6PqtKrOJj/3SCSCfuElVZFjbvI6v+H7yOavoHQmBGqpO5XfC6RWI\r
+       Zilg==\r
+X-Received: by 10.152.46.17 with SMTP id r17mr13047373lam.47.1362254128497;\r
+       Sat, 02 Mar 2013 11:55:28 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi.\r
+       [80.223.81.27])\r
+       by mx.google.com with ESMTPS id ng6sm8940635lab.2.2013.03.02.11.55.26\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sat, 02 Mar 2013 11:55:27 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH 3/3] cli: support Mail-Followup-To: in notmuch reply\r
+Date: Sat,  2 Mar 2013 21:55:21 +0200\r
+Message-Id:\r
+ <f9c7258be72bec0b174553db0410c29eba2745fa.1362254104.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To:\r
+ <5eaa3acc22ee5513bdce5ab931b7a79ade880e06.1362254104.git.jani@nikula.org>\r
+References:\r
+ <5eaa3acc22ee5513bdce5ab931b7a79ade880e06.1362254104.git.jani@nikula.org>\r
+In-Reply-To:\r
+ <5eaa3acc22ee5513bdce5ab931b7a79ade880e06.1362254104.git.jani@nikula.org>\r
+References:\r
+ <5eaa3acc22ee5513bdce5ab931b7a79ade880e06.1362254104.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQnENX3peeFiDoDAWR6l302DpC0wStKKHdWJfHPtba0plNfof/PUqJ1B3oPDOPsb+kAAfZrm\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 02 Mar 2013 19:55:36 -0000\r
+\r
+Use Mail-Followup-To header to determine recipients according to\r
+http://cr.yp.to/proto/replyto.html if configured and present in the\r
+message being replied to.\r
+---\r
+ notmuch-reply.c |   25 +++++++++++++++++++++++--\r
+ 1 file changed, 23 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index 22c58ff..604691a 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -324,6 +324,7 @@ add_recipients_from_message (GMimeMessage *reply,\r
+       { "bcc",        NULL, GMIME_RECIPIENT_TYPE_BCC }\r
+     };\r
+     const char *from_addr = NULL;\r
++    const char *recipients;\r
+     unsigned int i;\r
+     unsigned int n = 0;\r
\r
+@@ -343,9 +344,29 @@ add_recipients_from_message (GMimeMessage *reply,\r
+       reply_to_map[0].fallback = NULL;\r
+     }\r
\r
+-    for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {\r
+-      const char *recipients;\r
++    /* Use Mail-Followup-To header to determine recipients according\r
++     * to http://cr.yp.to/proto/replyto.html if configured and present\r
++     * in the message being replied to.\r
++     */\r
++    if (reply_all && notmuch_config_get_reply_honor_followup_to (config)) {\r
++      recipients = notmuch_message_get_header (message, "mail-followup-to");\r
++      if (recipients && *recipients) {\r
++          n = scan_address_string (recipients, config, reply,\r
++                                   GMIME_RECIPIENT_TYPE_TO, &from_addr);\r
++          if (n) {\r
++              /* Same rationale as in the loop below. */\r
++              reply = NULL;\r
++\r
++              /* From address and some recipients are enough, bail out. */\r
++              if (from_addr)\r
++                  return from_addr;\r
++\r
++              /* Else need to find from address in other headers. */\r
++          }\r
++      }\r
++    }\r
\r
++    for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) {\r
+       recipients = notmuch_message_get_header (message,\r
+                                                reply_to_map[i].header);\r
+       if ((recipients == NULL || recipients[0] == '\0') && reply_to_map[i].fallback)\r
+-- \r
+1.7.10.4\r
+\r