From a9092d2c6971da9214f317d84cb749d7fcc88b4d Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 15 Jul 2014 09:04:31 +2000 Subject: [PATCH] Re: notmuch-reply date format --- 18/a750ad551dd11c737aad97cb7bddbefe5de5b5 | 125 ++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 18/a750ad551dd11c737aad97cb7bddbefe5de5b5 diff --git a/18/a750ad551dd11c737aad97cb7bddbefe5de5b5 b/18/a750ad551dd11c737aad97cb7bddbefe5de5b5 new file mode 100644 index 000000000..8b64015ca --- /dev/null +++ b/18/a750ad551dd11c737aad97cb7bddbefe5de5b5 @@ -0,0 +1,125 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 4A988431FBD + for ; Mon, 14 Jul 2014 06:04:42 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id BFjEufi6-rIM for ; + Mon, 14 Jul 2014 06:04:37 -0700 (PDT) +Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu + [18.7.68.35]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 6B314431FBC + for ; Mon, 14 Jul 2014 06:04:37 -0700 (PDT) +X-AuditID: 12074423-f79bf6d000007580-1d-53c3d564ad56 +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + (using TLS with cipher AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP + id EE.26.30080.465D3C35; Mon, 14 Jul 2014 09:04:36 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id s6ED4YkN008197; + Mon, 14 Jul 2014 09:04:36 -0400 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s6ED4W5M027492 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Mon, 14 Jul 2014 09:04:33 -0400 +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1X6fvj-0000OI-Ti; Mon, 14 Jul 2014 09:04:32 -0400 +Date: Mon, 14 Jul 2014 09:04:31 -0400 +From: Austin Clements +To: Sime Ramov +Subject: Re: notmuch-reply date format +Message-ID: <20140714130431.GB4660@mit.edu> +References: <1722345767858996112.enqueue@ouroboros.ramov.inet> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1722345767858996112.enqueue@ouroboros.ramov.inet> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFmpgleLIzCtJLcpLzFFi42IR4hTV1k25ejjYYEOnscX1mzOZLW7+3Mrq + wOTxbNUtZo+Ll5QDmKK4bFJSczLLUov07RK4Mq5/2M9SsJSv4vK6brYGxm7uLkZODgkBE4k/ + k06xQdhiEhfurQeyuTiEBGYzSRx/spYZwtnIKLH061YmkCohgdNMErPelUEkljBKHHrxjREk + wSKgKvHn6zWwUWwCGhLb9i8HinNwiAgoStxcoQoSZhaQlvj2uxlsjrCAmsS+f3fAWnkFtCWW + 9Pxig5hvJ3Hn+S02iLigxMmZT1ggerUkbvx7yQQyEmTO8n8cICangL3E14k1IBWiAioSU05u + Y5vAKDQLSfMsJM2zEJoXMDKvYpRNya3SzU3MzClOTdYtTk7My0st0jXTy80s0UtNKd3ECApo + dhflHYx/DiodYhTgYFTi4c3gOBwsxJpYVlyZe4hRkoNJSZR3+UGgEF9SfkplRmJxRnxRaU5q + 8SFGCQ5mJRHe00eBcrwpiZVVqUX5MClpDhYlcd631lbBQgLpiSWp2ampBalFMFkZDg4lCd6+ + K0CNgkWp6akVaZk5JQhpJg5OkOE8QMP3gtTwFhck5hZnpkPkTzEqSonzHrgMlBAASWSU5sH1 + whLOK0ZxoFeEeX+CtPMAkxVc9yugwUxAg8trwAaXJCKkpBoYy55btj+Kbr/e8Eo2tTjW/Ntd + 2R3WDBvO3S0/0LDgzlr+yJIAgSkWpeXJp7NY/jYvkJOa+6pktoPXYgZmxcbo86YRTwqWb/ws + k3hPKamMU89T6MOUMK2O2flPZr55XCR//artNfHgi3PzfohIqJ3n9VrG7b4n1v4z6/IZl3fb + z9p2x69D0TJGiaU4I9FQi7moOBEA2fszdBMDAAA= +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 14 Jul 2014 13:04:42 -0000 + +Quoth Sime Ramov on Jul 14 at 2:28 pm: +> Hello, +> +> I would like to customize the attribution string in the reply templates. +> Something like this, with ISO date: +> +> * Full Name [2014-07-14 12:30 +0200]: +> +> After the following trivial edit: +> +> diff --git a/notmuch-reply.c b/notmuch-reply.c +> index 7c1c809..eaf1eed 100644 +> --- a/notmuch-reply.c +> +++ b/notmuch-reply.c +> @@ -44,9 +44,9 @@ 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")); +> + printf ("* %s [%s]:\n", +> + notmuch_message_get_header (node->envelope_file, "from"), +> + notmuch_message_get_header (node->envelope_file, "date")); +> } else if (GMIME_IS_MESSAGE (node->part)) { +> GMimeMessage *message = GMIME_MESSAGE (node->part); +> InternetAddressList *recipients; +> +> The (partial) result is this: +> +> * Full Name [Mon, 14 Jul 2014 12:30:36 +0200]: +> +> Where would be the best place to `strftime` date? I snooped around in +> lib/ source but haven't gotten far. Any ideas? Is it a Xapian thing? + +Hi Sime. + +First, are you sure this is the right place to modify reply +attribution? The Emacs frontend builds its own reply template. I'm +not sure what the other frontends do. + +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. The call to notmuch_message_get_header returns the literal +text from the message's Date: header, while notmuch_message_get_date +returns the parsed Date: header as a time_t. -- 2.26.2