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