[PATCH 1/3] cli: show: separate out the printing of recipient headers
Mark Walters
markwalters1009 at gmail.com
Sat May 11 13:15:42 PDT 2013
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
More information about the notmuch
mailing list