--- /dev/null
+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 16718429E29\r
+ for <notmuch@notmuchmail.org>; Sat, 30 Mar 2013 07:21:41 -0700 (PDT)\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 9Yx3Uq6OrEs0 for <notmuch@notmuchmail.org>;\r
+ Sat, 30 Mar 2013 07:21:39 -0700 (PDT)\r
+Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com\r
+ [209.85.217.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id E0875429E31\r
+ for <notmuch@notmuchmail.org>; Sat, 30 Mar 2013 07:21:38 -0700 (PDT)\r
+Received: by mail-lb0-f170.google.com with SMTP id x11so933806lbi.15\r
+ for <notmuch@notmuchmail.org>; Sat, 30 Mar 2013 07:21:37 -0700 (PDT)\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=xWT7v4w/lPNvS58CLQ4CB7qFG7xkfR25irff06EzRMI=;\r
+ b=i6U75+BXmhO5qT7hqezwpxfx2ptJuCa2h+KVaeB43pww9ixwxOYW53IoJvyLgMNoGi\r
+ KwYxHriAVncRbxwkNM88sMG/GBtu1Y74Wl78QepJ6tHzMCiDMBPsPCh+0WIVLxJ7SEtX\r
+ RBbQmaNIwzWxknIoTQS5bUIGNZxQX3qpRLGPtabdys1lzidG4B9dknKjCE51inAmn8We\r
+ bkw4EoBDNbR5X7iqOBydvjbHFAf1QBo78l8RiFnUGILdIInPSlmcqQ5Q+8zj+B1IvkHM\r
+ 86XKUKTeJl5sZlhrXw+Fp+5mZIC/5h/JSZfSfjyspnoIyJF2VKqp1bKedpcZP4t8jiAQ\r
+ alDg==\r
+X-Received: by 10.112.173.39 with SMTP id bh7mr2956174lbc.62.1364653297399;\r
+ Sat, 30 Mar 2013 07:21:37 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi.\r
+ [80.223.81.27])\r
+ by mx.google.com with ESMTPS id fq10sm2651415lbb.14.2013.03.30.07.21.35\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sat, 30 Mar 2013 07:21:36 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 3/3] cli: support Mail-Followup-To: in notmuch reply\r
+Date: Sat, 30 Mar 2013 16:21:22 +0200\r
+Message-Id:\r
+ <390947231bc5d4fc4cb3b3aff94cd32bf25180f3.1364652420.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <cover.1364652420.git.jani@nikula.org>\r
+References: <cover.1364652420.git.jani@nikula.org>\r
+In-Reply-To: <cover.1364652420.git.jani@nikula.org>\r
+References: <cover.1364652420.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQlsmyZv2Z70cAjuKG+DrvJaaWlceGnjayoVqx24Nve02cdswTfdn9kesRtODdfeivU3WRZV\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, 30 Mar 2013 14:21:41 -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 e151f78..7391886 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