[RFC PATCH 3/3] cli: support Mail-Followup-To: in notmuch reply
Jani Nikula
jani at nikula.org
Sat Mar 2 11:55:21 PST 2013
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
More information about the notmuch
mailing list