unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/3] cli: show: separate out the printing of recipient headers
Date: Sat, 11 May 2013 21:15:42 +0100	[thread overview]
Message-ID: <1368303344-13713-2-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <1368303344-13713-1-git-send-email-markwalters1009@gmail.com>

This splits out the sprinter printing of recipient headers so that
notmuch-reply can call it directly. This will be used when reply
outputs header for reply-all and reply-to-sender.
---
 notmuch-client.h |    3 +++
 notmuch-show.c   |   35 +++++++++++++++++++++--------------
 2 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/notmuch-client.h b/notmuch-client.h
index 45749a6..d55d4c0 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -223,6 +223,9 @@ void
 format_headers_sprinter (struct sprinter *sp, GMimeMessage *message,
 			 notmuch_bool_t reply);
 
+void
+format_headers_recipients_sprinter (struct sprinter *sp, GMimeMessage *message);
+
 typedef enum {
     NOTMUCH_SHOW_TEXT_PART_REPLY = 1 << 0,
 } notmuch_show_text_part_flags;
diff --git a/notmuch-show.c b/notmuch-show.c
index 62178f7..8b9ab61 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -213,23 +213,10 @@ _is_from_line (const char *line)
 }
 
 void
-format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
-			 notmuch_bool_t reply)
+format_headers_recipients_sprinter (sprinter_t *sp, GMimeMessage *message)
 {
-    /* Any changes to the JSON or S-Expression format should be
-     * reflected in the file devel/schemata. */
-
     InternetAddressList *recipients;
     const char *recipients_string;
-    const char *reply_to_string;
-
-    sp->begin_map (sp);
-
-    sp->map_key (sp, "Subject");
-    sp->string (sp, g_mime_message_get_subject (message));
-
-    sp->map_key (sp, "From");
-    sp->string (sp, g_mime_message_get_sender (message));
 
     recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
     recipients_string = internet_address_list_to_string (recipients, 0);
@@ -251,6 +238,26 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
 	sp->map_key (sp, "Bcc");
 	sp->string (sp, recipients_string);
     }
+}
+
+void
+format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
+			 notmuch_bool_t reply)
+{
+    /* Any changes to the JSON or S-Expression format should be
+     * reflected in the file devel/schemata. */
+
+    const char *reply_to_string;
+
+    sp->begin_map (sp);
+
+    sp->map_key (sp, "Subject");
+    sp->string (sp, g_mime_message_get_subject (message));
+
+    sp->map_key (sp, "From");
+    sp->string (sp, g_mime_message_get_sender (message));
+
+    format_headers_recipients_sprinter (sp, message);
 
     reply_to_string = g_mime_message_get_reply_to (message);
     if (reply_to_string) {
-- 
1.7.9.1

  reply	other threads:[~2013-05-11 20:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-11 20:15 [PATCH 0/3] Allow widen reply Mark Walters
2013-05-11 20:15 ` Mark Walters [this message]
2013-05-11 20:15 ` [PATCH 2/3] cli: reply: additionally output reply-to-all headers to allow " Mark Walters
2013-05-11 20:15 ` [PATCH 3/3] emacs: mua: allow the user to widen the reply Mark Walters
2013-05-12 20:53 ` [PATCH 0/3] Allow widen reply Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368303344-13713-2-git-send-email-markwalters1009@gmail.com \
    --to=markwalters1009@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).