[PATCH v2 4/8] show: Move format_message_mbox with the other new-style formats
authorAustin Clements <amdragon@MIT.EDU>
Tue, 6 Mar 2012 18:48:40 +0000 (18:48 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:16 +0000 (09:45 -0800)
bf/ecb6ab2dd293b27df2c50c674435fe9e711609 [new file with mode: 0644]

diff --git a/bf/ecb6ab2dd293b27df2c50c674435fe9e711609 b/bf/ecb6ab2dd293b27df2c50c674435fe9e711609
new file mode 100644 (file)
index 0000000..84d4ba4
--- /dev/null
@@ -0,0 +1,199 @@
+Return-Path: <amthrax@drake.mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1B9A1431FD5\r
+       for <notmuch@notmuchmail.org>; Tue,  6 Mar 2012 10:48:53 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id leY1jjpNVReI for <notmuch@notmuchmail.org>;\r
+       Tue,  6 Mar 2012 10:48:51 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
+       [18.7.68.35])\r
+       by olra.theworths.org (Postfix) with ESMTP id C0A12431FCF\r
+       for <notmuch@notmuchmail.org>; Tue,  6 Mar 2012 10:48:51 -0800 (PST)\r
+X-AuditID: 12074423-b7f9c6d0000008c3-e4-4f565c139484\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id E2.FD.02243.31C565F4; Tue,  6 Mar 2012 13:48:51 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q26ImpvM020738; \r
+       Tue, 6 Mar 2012 13:48:51 -0500\r
+Received: from drake.mit.edu (firewall.royalsociety.org [193.63.75.2])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q26ImmXa016464\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Tue, 6 Mar 2012 13:48:50 -0500 (EST)\r
+Received: from amthrax by drake.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amthrax@drake.mit.edu>)\r
+       id 1S4zRI-0003pP-6I; Tue, 06 Mar 2012 18:48:48 +0000\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 4/8] show: Move format_message_mbox with the other\r
+       new-style formats\r
+Date: Tue,  6 Mar 2012 18:48:40 +0000\r
+Message-Id: <1331059724-14653-5-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.7.3\r
+In-Reply-To: <1331059724-14653-1-git-send-email-amdragon@mit.edu>\r
+References: <1330752025-2542-1-git-send-email-amdragon@mit.edu>\r
+       <1331059724-14653-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsUixG6nriscE+ZvcGmnpMWefV4W12/OZHZg\r
+       8rh7msvj2apbzAFMUVw2Kak5mWWpRfp2CVwZj2Z9ZCw4L1Exce1J1gbGR0JdjJwcEgImEg9P\r
+       NbFD2GISF+6tZ+ti5OIQEtjHKHHt5nsoZz2jxMQl09ghnINMEp2/1zFBOPMZJdYf+8MI0s8m\r
+       oCGxbf9yMFtEQFpi593ZrF2MHBzMAk4SbW1eIKawQLjEuR81IBUsAqoStyeAVHBy8Ao4SDSc\r
+       OM0CcYWCxLnV58Au4hRwlNjzdBPYRCGBMolLNy+wTGDkX8DIsIpRNiW3Sjc3MTOnODVZtzg5\r
+       MS8vtUjXTC83s0QvNaV0EyM4iFyUdzD+Oah0iFGAg1GJh7dKN8xfiDWxrLgy9xCjJAeTkihv\r
+       ThRQiC8pP6UyI7E4I76oNCe1+BCjBAezkgjvt/eh/kK8KYmVValF+TApaQ4WJXFeDa13fkIC\r
+       6YklqdmpqQWpRTBZGQ4OJQnejGigoYJFqempFWmZOSUIaSYOTpDhPEDDjUBqeIsLEnOLM9Mh\r
+       8qcYFaXEef1AEgIgiYzSPLheWJS/YhQHekWYtw6kigeYIOC6XwENZgIa3KYcDDK4JBEhJdXA\r
+       ePzhjKyFkks2vsq41PJ46ft4810/cl/beO96q/NhYvjyggbxlPcMlcVKQeeatznFnHLtCDrf\r
+       Xu44pe3z6vCb/tmTt9y7tD3NQXunv32I6szKlZvirTluOr1acCTGkDXI79uxtBq7bf2f//Am\r
+       L6vfxtbcNjXq73m1x8lrv1SzTC7RTk1wdFu/TYmlOCPRUIu5qDgRAJtwZU/NAgAA\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 06 Mar 2012 18:48:53 -0000\r
+\r
+Just code motion.\r
+---\r
+ notmuch-show.c |  100 ++++++++++++++++++++++++++++----------------------------\r
+ 1 files changed, 50 insertions(+), 50 deletions(-)\r
+\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index 648f468..b3a4550 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -219,56 +219,6 @@ _is_from_line (const char *line)\r
+       return 0;\r
+ }\r
\r
+-/* Print a message in "mboxrd" format as documented, for example,\r
+- * here:\r
+- *\r
+- * http://qmail.org/qmail-manual-html/man5/mbox.html\r
+- */\r
+-static void\r
+-format_message_mbox (const void *ctx,\r
+-                   notmuch_message_t *message,\r
+-                   unused (int indent))\r
+-{\r
+-    const char *filename;\r
+-    FILE *file;\r
+-    const char *from;\r
+-\r
+-    time_t date;\r
+-    struct tm date_gmtime;\r
+-    char date_asctime[26];\r
+-\r
+-    char *line = NULL;\r
+-    size_t line_size;\r
+-    ssize_t line_len;\r
+-\r
+-    filename = notmuch_message_get_filename (message);\r
+-    file = fopen (filename, "r");\r
+-    if (file == NULL) {\r
+-      fprintf (stderr, "Failed to open %s: %s\n",\r
+-               filename, strerror (errno));\r
+-      return;\r
+-    }\r
+-\r
+-    from = notmuch_message_get_header (message, "from");\r
+-    from = _extract_email_address (ctx, from);\r
+-\r
+-    date = notmuch_message_get_date (message);\r
+-    gmtime_r (&date, &date_gmtime);\r
+-    asctime_r (&date_gmtime, date_asctime);\r
+-\r
+-    printf ("From %s %s", from, date_asctime);\r
+-\r
+-    while ((line_len = getline (&line, &line_size, file)) != -1 ) {\r
+-      if (_is_from_line (line))\r
+-          putchar ('>');\r
+-      printf ("%s", line);\r
+-    }\r
+-\r
+-    printf ("\n");\r
+-\r
+-    fclose (file);\r
+-}\r
+-\r
+ static void\r
+ format_headers_message_part_text (GMimeMessage *message)\r
+ {\r
+@@ -762,6 +712,56 @@ format_part_json_entry (const void *ctx, mime_node_t *node, unused (int indent),\r
+     return NOTMUCH_STATUS_SUCCESS;\r
+ }\r
\r
++/* Print a message in "mboxrd" format as documented, for example,\r
++ * here:\r
++ *\r
++ * http://qmail.org/qmail-manual-html/man5/mbox.html\r
++ */\r
++static void\r
++format_message_mbox (const void *ctx,\r
++                   notmuch_message_t *message,\r
++                   unused (int indent))\r
++{\r
++    const char *filename;\r
++    FILE *file;\r
++    const char *from;\r
++\r
++    time_t date;\r
++    struct tm date_gmtime;\r
++    char date_asctime[26];\r
++\r
++    char *line = NULL;\r
++    size_t line_size;\r
++    ssize_t line_len;\r
++\r
++    filename = notmuch_message_get_filename (message);\r
++    file = fopen (filename, "r");\r
++    if (file == NULL) {\r
++      fprintf (stderr, "Failed to open %s: %s\n",\r
++               filename, strerror (errno));\r
++      return;\r
++    }\r
++\r
++    from = notmuch_message_get_header (message, "from");\r
++    from = _extract_email_address (ctx, from);\r
++\r
++    date = notmuch_message_get_date (message);\r
++    gmtime_r (&date, &date_gmtime);\r
++    asctime_r (&date_gmtime, date_asctime);\r
++\r
++    printf ("From %s %s", from, date_asctime);\r
++\r
++    while ((line_len = getline (&line, &line_size, file)) != -1 ) {\r
++      if (_is_from_line (line))\r
++          putchar ('>');\r
++      printf ("%s", line);\r
++    }\r
++\r
++    printf ("\n");\r
++\r
++    fclose (file);\r
++}\r
++\r
+ static notmuch_status_t\r
+ show_message (void *ctx,\r
+             const notmuch_show_format_t *format,\r
+-- \r
+1.7.7.3\r
+\r