unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/5] show: Move format_message_mbox with the other new-style formats
Date: Sat,  3 Mar 2012 00:20:22 -0500	[thread overview]
Message-ID: <1330752025-2542-3-git-send-email-amdragon@mit.edu> (raw)
In-Reply-To: <1330752025-2542-1-git-send-email-amdragon@mit.edu>

Just code motion.
---
 notmuch-show.c |  100 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 648f468..b3a4550 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -219,56 +219,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)
 {
@@ -762,6 +712,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,
-- 
1.7.7.3

  parent reply	other threads:[~2012-03-03  5:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-03  5:20 [PATCH 0/5] Rewrite mbox and raw show formats Austin Clements
2012-03-03  5:20 ` [PATCH 1/5] show: Allow formatters to return errors Austin Clements
2012-03-03  5:20 ` Austin Clements [this message]
2012-03-03  5:20 ` [PATCH 3/5] show: Convert mbox format to new self-recursive style Austin Clements
2012-03-03  5:20 ` [PATCH 4/5] show: Move format_part_content_raw with the other new-style formats Austin Clements
2012-03-03  5:20 ` [PATCH 5/5] show: Convert raw format to the new self-recursive style Austin Clements
2012-03-03 22:05   ` Jameson Graef Rollins
2012-03-06 18:43     ` Austin Clements
2012-03-03  8:18 ` [PATCH 0/5] Rewrite mbox and raw show formats Tomi Ollila
2012-03-06 18:48 ` [PATCH v2 0/8] " Austin Clements
2012-03-06 18:48   ` [PATCH v2 1/8] test: Fix typo in test description Austin Clements
2012-03-06 18:48   ` [PATCH v2 2/8] test: Fix malformed multipart message Austin Clements
2012-03-06 18:48   ` [PATCH v2 3/8] show: Allow formatters to return errors Austin Clements
2012-03-06 21:22     ` Mark Walters
2012-03-07 20:18       ` Tomi Ollila
2012-03-11 23:34       ` Austin Clements
2012-03-06 18:48   ` [PATCH v2 4/8] show: Move format_message_mbox with the other new-style formats Austin Clements
2012-03-06 18:48   ` [PATCH v2 5/8] show: Convert mbox format to new self-recursive style Austin Clements
2012-03-06 18:48   ` [PATCH v2 6/8] show: Move format_part_content_raw with the other new-style formats Austin Clements
2012-03-06 18:48   ` [PATCH v2 7/8] show: Convert raw format to the new self-recursive style, properly support interior parts Austin Clements
2012-03-06 18:48   ` [PATCH v2 8/8] man: Update raw format documentation Austin Clements
2012-03-09  3:25   ` [PATCH v2 0/8] Rewrite mbox and raw show formats Adam Wolfe Gordon
2012-03-18 12:51   ` David Bremner

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=1330752025-2542-3-git-send-email-amdragon@mit.edu \
    --to=amdragon@mit.edu \
    --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).