aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch-show.c
diff options
context:
space:
mode:
authorAustin Clements <amdragon@MIT.EDU>2012-03-06 18:48:40 +0000
committerDavid Bremner <bremner@debian.org>2012-03-18 09:14:21 -0300
commit8d01b0749c16bab0f0e01066a9afa9786193e739 (patch)
treedf664956ce6c514b5f2c78478e8914f55e595f9d /notmuch-show.c
parent6a4df1b796ea82545fa0861d341aa6769f72ac02 (diff)
show: Move format_message_mbox with the other new-style formats
Just code motion.
Diffstat (limited to 'notmuch-show.c')
-rw-r--r--notmuch-show.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/notmuch-show.c b/notmuch-show.c
index 8a8c0fc5..f13e1875 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -220,56 +220,6 @@ _is_from_line (const char *line)
return 0;
}
-/* Print a message in "mboxrd" format as documented, for example,
- * here:
- *
- * http://qmail.org/qmail-manual-html/man5/mbox.html
- */
-static void
-format_message_mbox (const void *ctx,
- notmuch_message_t *message,
- unused (int indent))
-{
- const char *filename;
- FILE *file;
- const char *from;
-
- time_t date;
- struct tm date_gmtime;
- char date_asctime[26];
-
- char *line = NULL;
- size_t line_size;
- ssize_t line_len;
-
- filename = notmuch_message_get_filename (message);
- file = fopen (filename, "r");
- if (file == NULL) {
- fprintf (stderr, "Failed to open %s: %s\n",
- filename, strerror (errno));
- return;
- }
-
- from = notmuch_message_get_header (message, "from");
- from = _extract_email_address (ctx, from);
-
- date = notmuch_message_get_date (message);
- gmtime_r (&date, &date_gmtime);
- asctime_r (&date_gmtime, date_asctime);
-
- printf ("From %s %s", from, date_asctime);
-
- while ((line_len = getline (&line, &line_size, file)) != -1 ) {
- if (_is_from_line (line))
- putchar ('>');
- printf ("%s", line);
- }
-
- printf ("\n");
-
- fclose (file);
-}
-
static void
format_headers_message_part_text (GMimeMessage *message)
{
@@ -764,6 +714,56 @@ format_part_json_entry (const void *ctx, mime_node_t *node, unused (int indent),
return NOTMUCH_STATUS_SUCCESS;
}
+/* Print a message in "mboxrd" format as documented, for example,
+ * here:
+ *
+ * http://qmail.org/qmail-manual-html/man5/mbox.html
+ */
+static void
+format_message_mbox (const void *ctx,
+ notmuch_message_t *message,
+ unused (int indent))
+{
+ const char *filename;
+ FILE *file;
+ const char *from;
+
+ time_t date;
+ struct tm date_gmtime;
+ char date_asctime[26];
+
+ char *line = NULL;
+ size_t line_size;
+ ssize_t line_len;
+
+ filename = notmuch_message_get_filename (message);
+ file = fopen (filename, "r");
+ if (file == NULL) {
+ fprintf (stderr, "Failed to open %s: %s\n",
+ filename, strerror (errno));
+ return;
+ }
+
+ from = notmuch_message_get_header (message, "from");
+ from = _extract_email_address (ctx, from);
+
+ date = notmuch_message_get_date (message);
+ gmtime_r (&date, &date_gmtime);
+ asctime_r (&date_gmtime, date_asctime);
+
+ printf ("From %s %s", from, date_asctime);
+
+ while ((line_len = getline (&line, &line_size, file)) != -1 ) {
+ if (_is_from_line (line))
+ putchar ('>');
+ printf ("%s", line);
+ }
+
+ printf ("\n");
+
+ fclose (file);
+}
+
static notmuch_status_t
show_message (void *ctx,
const notmuch_show_format_t *format,