notmuch-reply date format

Sime Ramov sramov at pobox.com
Tue Jul 15 00:35:30 PDT 2014


Hello,

* Austin Clements <amdragon at MIT.EDU> [Mon, 14 Jul 2014 09:04:31 -0400]:
> Assuming the CLI is the right place for you to change this, you
> probably want to call notmuch_message_get_date, then localtime, then
> strftime.

Tried to get this working to no avail. Not a programmer obviously :) I
cobbled this together from various online sources:

diff --git a/notmuch-reply.c b/notmuch-reply.c
index 7c1c809..16cf19c 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -44,9 +44,15 @@ format_part_reply (mime_node_t *node)
     int i;
 
     if (node->envelope_file) {
-	printf ("On %s, %s wrote:\n",
-		notmuch_message_get_header (node->envelope_file, "date"),
-		notmuch_message_get_header (node->envelope_file, "from"));
+	struct tm *info;
+	char dbuf[30];
+
+	info = localtime(notmuch_message_get_date(node->envelope_file));
+
+	strftime(dbuf, sizeof(dbuf), "%F %R %z", info);
+	printf ("* %s [%s]:\n",
+		notmuch_message_get_header(node->envelope_file, "from"), dbuf);
+
     } else if (GMIME_IS_MESSAGE (node->part)) {
 	GMimeMessage *message = GMIME_MESSAGE (node->part);
 	InternetAddressList *recipients;

When compiling I get this warning:

notmuch-reply.c: In function 'format_part_reply':
notmuch-reply.c:50: warning: passing argument 1 of 'localtime' makes pointer from integer without a cast

And a core dump when notmuch reply is invoked on a message. Am I even
close? :) Thanks


More information about the notmuch mailing list