[PATCH 4/5] show: include mtime in JSON output
authorThomas Jost <schnouki@schnouki.net>
Tue, 13 Dec 2011 17:11:44 +0000 (18:11 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:48 +0000 (09:40 -0800)
14/09100782fb8466a0edd9cf18e35787cb2fda6f [new file with mode: 0644]

diff --git a/14/09100782fb8466a0edd9cf18e35787cb2fda6f b/14/09100782fb8466a0edd9cf18e35787cb2fda6f
new file mode 100644 (file)
index 0000000..45a6bc9
--- /dev/null
@@ -0,0 +1,86 @@
+Return-Path: <schnouki@schnouki.net>\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 30355429E35\r
+       for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 09:12:12 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.1\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1]\r
+       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 0Wj+54JyHqlX for <notmuch@notmuchmail.org>;\r
+       Tue, 13 Dec 2011 09:12:11 -0800 (PST)\r
+Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222])\r
+       by olra.theworths.org (Postfix) with ESMTP id BC938429E2F\r
+       for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 09:12:09 -0800 (PST)\r
+Received: from thor.loria.fr (thor.loria.fr [152.81.12.250])\r
+       by ks3536.kimsufi.com (Postfix) with ESMTPSA id CEE356A002C;\r
+       Tue, 13 Dec 2011 18:12:08 +0100 (CET)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;\r
+       s=key-schnouki; t=1323796328;\r
+       bh=dGTD7tVlVyR+9TCoMXhCMn5JsBpIyJ3LZvr55+Qv1y4=;\r
+       h=From:To:Subject:Date:Message-Id:In-Reply-To:References;\r
+       b=VNEPIElefb7QRqmyLemyG3mzqAUm4BDHP11+8/mdT4hH4m/P5c1KMsGMd6qcKPBIE\r
+       tB2uOsP+9RaJH6WVkQm41ps6ZiCOwnvbM/rFqq0HwfxP3WIIgDigH8iD7aStwDi3q3\r
+       tCUXIAJqT6cOITCYgXMUUHnGa6Y+yCZHTI400QqA=\r
+From: Thomas Jost <schnouki@schnouki.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 4/5] show: include mtime in JSON output\r
+Date: Tue, 13 Dec 2011 18:11:44 +0100\r
+Message-Id: <1323796305-28789-5-git-send-email-schnouki@schnouki.net>\r
+X-Mailer: git-send-email 1.7.8\r
+In-Reply-To: <1323796305-28789-1-git-send-email-schnouki@schnouki.net>\r
+References: <1323796305-28789-1-git-send-email-schnouki@schnouki.net>\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, 13 Dec 2011 17:12:12 -0000\r
+\r
+This could be used by a UI implementation somehow.\r
+---\r
+ notmuch-show.c |    7 ++++---\r
+ 1 files changed, 4 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index 873a7c4..7279601 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -202,17 +202,18 @@ format_message_json (const void *ctx, notmuch_message_t *message, unused (int in\r
+     notmuch_tags_t *tags;\r
+     int first = 1;\r
+     void *ctx_quote = talloc_new (ctx);\r
+-    time_t date;\r
++    time_t date, mtime;\r
+     const char *relative_date;\r
\r
+     date = notmuch_message_get_date (message);\r
+     relative_date = notmuch_time_relative_date (ctx, date);\r
++    mtime = notmuch_message_get_mtime (message);\r
\r
+-    printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"tags\": [",\r
++    printf ("\"id\": %s, \"match\": %s, \"filename\": %s, \"timestamp\": %ld, \"date_relative\": \"%s\", \"mtime\": %ld, \"tags\": [",\r
+           json_quote_str (ctx_quote, notmuch_message_get_message_id (message)),\r
+           notmuch_message_get_flag (message, NOTMUCH_MESSAGE_FLAG_MATCH) ? "true" : "false",\r
+           json_quote_str (ctx_quote, notmuch_message_get_filename (message)),\r
+-          date, relative_date);\r
++          date, relative_date, mtime);\r
\r
+     for (tags = notmuch_message_get_tags (message);\r
+        notmuch_tags_valid (tags);\r
+-- \r
+1.7.8\r
+\r