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 85F03431FC9 for ; Tue, 15 Jul 2014 07:14:28 -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 rjfSKzjFYdC2 for ; Tue, 15 Jul 2014 07:14:23 -0700 (PDT) Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu [18.9.25.13]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id A94DA431FC7 for ; Tue, 15 Jul 2014 07:14:23 -0700 (PDT) X-AuditID: 1209190d-f79c06d000002f07-d8-53c5373c88fa Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP id 3A.24.12039.E3735C35; Tue, 15 Jul 2014 10:14:23 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id s6FEEAFY017884; Tue, 15 Jul 2014 10:14:11 -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 s6FEE9cb011614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 15 Jul 2014 10:14:10 -0400 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) (envelope-from ) id 1X73Ue-0000cK-7V; Tue, 15 Jul 2014 10:14:08 -0400 Date: Tue, 15 Jul 2014 10:14:07 -0400 From: Austin Clements To: Sime Ramov Subject: Re: notmuch-reply date format Message-ID: <20140715141407.GF4660@mit.edu> References: <1722345767858996112.enqueue@ouroboros.ramov.inet> <20140714130431.GB4660@mit.edu> <702358554056882337.enqueue@ouroboros.ramov.inet> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <702358554056882337.enqueue@ouroboros.ramov.inet> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgleLIzCtJLcpLzFFi42IR4hRV1rU3Pxps0LKCyeL6zZnMFjd/bmV1 YPJ4tuoWs8fFS8oBTFFcNimpOZllqUX6dglcGYcbF7IWtApU/Fuf1MD4g6eLkZNDQsBE4ti2 10wQtpjEhXvr2boYuTiEBGYzSVzqOs4OkhAS2MgosaFNBSJxmkliwe6XrBDOEkaJlunHwKpY BFQlZvx+wgJiswloSGzbv5yxi5GDQ0RAUeLmClWQMLOAtMS3381g24QF1CT2/bvDCGLzCmhL nPl/lh1i5hRGiU99R1ghEoISJ2dCzGQW0JK48e8lE8hMkEHL/3GAmJwCdhIzd2eAVIgKqEhM ObmNbQKj0CwkzbOQNM9CaF7AyLyKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI10gvN7NELzWldBMj OKAleXcwvjuodIhRgINRiYf3xKfDwUKsiWXFlbmHGCU5mJREeYvZjgYL8SXlp1RmJBZnxBeV 5qQWH2KU4GBWEuGVNAHK8aYkVlalFuXDpKQ5WJTEed9aWwULCaQnlqRmp6YWpBbBZGU4OJQk eD3NgBoFi1LTUyvSMnNKENJMHJwgw3mAhqeB1PAWFyTmFmemQ+RPMSpKifMymwIlBEASGaV5 cL2whPOKURzoFWHeDJB2HmCygut+BTSYCWhwec1hkMEliQgpqQbGXmaL4z5Wzx/ufpe7zzrR /d/7BQe1JM+8f/egrzT2/tSM9stb8jfKOxW3rZLvOV3K5p5SfYW59myv9ZT30VmdfTPvRghK emTYpnLNq57MPdFwu6pNotHnDIv4LXF1X1mZzQzL1ipb3cz/clSxkLXTZ/Or43Edvhms7h47 7WbcLX0W7qxSF6rEUpyRaKjFXFScCADrAAt+EwMAAA== 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: Tue, 15 Jul 2014 14:14:28 -0000 Quoth Sime Ramov on Jul 15 at 9:35 am: > Hello, > > * Austin Clements [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)); Close. For whatever reason, localtime takes a pointer to a time_t, not a time_t (even though time_t is just a number). You'll need something like time_t date; date = notmuch_message_get_date(node->envelope_file); info = localtime(&date); > + > + 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 Ah, C. "I'm sure they meant for that number that looks nothing like a pointer to actually be a pointer that could corrupt memory, disclose private information, or crash the program. I'll just convert it for them real quick..." > And a core dump when notmuch reply is invoked on a message. Am I even > close? :) Thanks