[PATCH 2/3] cli: reply: additionally output reply-to-all headers to allow widen reply
Mark Walters
markwalters1009 at gmail.com
Sat May 11 13:15:43 PDT 2013
This additionally outputs the reply-to-all versions To: Cc: and Bcc:
fields under the heading reply-all-recipients so that a frontend can
`widen' the reply.
---
notmuch-reply.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/notmuch-reply.c b/notmuch-reply.c
index e151f78..6935f69 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -595,7 +595,7 @@ notmuch_reply_format_sprinter(void *ctx,
notmuch_bool_t reply_all,
sprinter_t *sp)
{
- GMimeMessage *reply;
+ GMimeMessage *reply_all_recipients, *reply;
notmuch_messages_t *messages;
notmuch_message_t *message;
mime_node_t *node;
@@ -614,6 +614,14 @@ notmuch_reply_format_sprinter(void *ctx,
if (!reply)
return 1;
+ /* The 1 means we want headers in a "pretty" order. */
+ reply_all_recipients = g_mime_message_new (1);
+ if (reply_all_recipients == NULL) {
+ fprintf (stderr, "Out of memory\n");
+ return 1;
+ }
+ add_recipients_from_message (reply_all_recipients, config, message, TRUE);
+
sp->begin_map (sp);
/* The headers of the reply message we've created */
@@ -622,6 +630,14 @@ notmuch_reply_format_sprinter(void *ctx,
g_object_unref (G_OBJECT (reply));
reply = NULL;
+ /* The recipient headers if we were applying to all */
+ sp->map_key (sp, "reply-all-recipients");
+ sp->begin_map (sp);
+ format_headers_recipients_sprinter (sp, reply_all_recipients);
+ sp->end (sp);
+ g_object_unref (G_OBJECT (reply_all_recipients));
+ reply_all_recipients = NULL;
+
/* Start the original */
sp->map_key (sp, "original");
format_part_sprinter (ctx, sp, node, TRUE, TRUE);
--
1.7.9.1
More information about the notmuch
mailing list