Re: notmuch-reply date format
authorAustin Clements <amdragon@MIT.EDU>
Tue, 15 Jul 2014 14:14:07 +0000 (10:14 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:03:40 +0000 (10:03 -0800)
ae/cdc2acb34f354ba4b8aa781355140025d6d408 [new file with mode: 0644]

diff --git a/ae/cdc2acb34f354ba4b8aa781355140025d6d408 b/ae/cdc2acb34f354ba4b8aa781355140025d6d408
new file mode 100644 (file)
index 0000000..c0d21d2
--- /dev/null
@@ -0,0 +1,139 @@
+Return-Path: <amdragon@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 85F03431FC9\r
+       for <notmuch@notmuchmail.org>; Tue, 15 Jul 2014 07:14:28 -0700 (PDT)\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 rjfSKzjFYdC2 for <notmuch@notmuchmail.org>;\r
+       Tue, 15 Jul 2014 07:14:23 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu\r
+       [18.9.25.13])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id A94DA431FC7\r
+       for <notmuch@notmuchmail.org>; Tue, 15 Jul 2014 07:14:23 -0700 (PDT)\r
+X-AuditID: 1209190d-f79c06d000002f07-d8-53c5373c88fa\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       (using TLS with cipher AES256-SHA (256/256 bits))\r
+       (Client did not present a certificate)\r
+       by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 3A.24.12039.E3735C35; Tue, 15 Jul 2014 10:14:23 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id s6FEEAFY017884; \r
+       Tue, 15 Jul 2014 10:14:11 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s6FEE9cb011614\r
+       (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+       Tue, 15 Jul 2014 10:14:10 -0400\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1X73Ue-0000cK-7V; Tue, 15 Jul 2014 10:14:08 -0400\r
+Date: Tue, 15 Jul 2014 10:14:07 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Sime Ramov <sramov@pobox.com>\r
+Subject: Re: notmuch-reply date format\r
+Message-ID: <20140715141407.GF4660@mit.edu>\r
+References: <1722345767858996112.enqueue@ouroboros.ramov.inet>\r
+       <20140714130431.GB4660@mit.edu>\r
+       <702358554056882337.enqueue@ouroboros.ramov.inet>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <702358554056882337.enqueue@ouroboros.ramov.inet>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmpgleLIzCtJLcpLzFFi42IR4hRV1rU3Pxps0LKCyeL6zZnMFjd/bmV1\r
+       YPJ4tuoWs8fFS8oBTFFcNimpOZllqUX6dglcGYcbF7IWtApU/Fuf1MD4g6eLkZNDQsBE4ti2\r
+       10wQtpjEhXvr2boYuTiEBGYzSVzqOs4OkhAS2MgosaFNBSJxmkliwe6XrBDOEkaJlunHwKpY\r
+       BFQlZvx+wgJiswloSGzbv5yxi5GDQ0RAUeLmClWQMLOAtMS3381g24QF1CT2/bvDCGLzCmhL\r
+       nPl/lh1i5hRGiU99R1ghEoISJ2dCzGQW0JK48e8lE8hMkEHL/3GAmJwCdhIzd2eAVIgKqEhM\r
+       ObmNbQKj0CwkzbOQNM9CaF7AyLyKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI10gvN7NELzWldBMj\r
+       OKAleXcwvjuodIhRgINRiYf3xKfDwUKsiWXFlbmHGCU5mJREeYvZjgYL8SXlp1RmJBZnxBeV\r
+       5qQWH2KU4GBWEuGVNAHK8aYkVlalFuXDpKQ5WJTEed9aWwULCaQnlqRmp6YWpBbBZGU4OJQk\r
+       eD3NgBoFi1LTUyvSMnNKENJMHJwgw3mAhqeB1PAWFyTmFmemQ+RPMSpKifMymwIlBEASGaV5\r
+       cL2whPOKURzoFWHeDJB2HmCygut+BTSYCWhwec1hkMEliQgpqQbGXmaL4z5Wzx/ufpe7zzrR\r
+       /d/7BQe1JM+8f/egrzT2/tSM9stb8jfKOxW3rZLvOV3K5p5SfYW59myv9ZT30VmdfTPvRghK\r
+       emTYpnLNq57MPdFwu6pNotHnDIv4LXF1X1mZzQzL1ipb3cz/clSxkLXTZ/Or43Edvhms7h47\r
+       7WbcLX0W7qxSF6rEUpyRaKjFXFScCADrAAt+EwMAAA==\r
+Cc: notmuch@notmuchmail.org\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, 15 Jul 2014 14:14:28 -0000\r
+\r
+Quoth Sime Ramov on Jul 15 at  9:35 am:\r
+> Hello,\r
+> \r
+> * Austin Clements <amdragon@MIT.EDU> [Mon, 14 Jul 2014 09:04:31 -0400]:\r
+> > Assuming the CLI is the right place for you to change this, you\r
+> > probably want to call notmuch_message_get_date, then localtime, then\r
+> > strftime.\r
+> \r
+> Tried to get this working to no avail. Not a programmer obviously :) I\r
+> cobbled this together from various online sources:\r
+> \r
+> diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+> index 7c1c809..16cf19c 100644\r
+> --- a/notmuch-reply.c\r
+> +++ b/notmuch-reply.c\r
+> @@ -44,9 +44,15 @@ format_part_reply (mime_node_t *node)\r
+>      int i;\r
+>  \r
+>      if (node->envelope_file) {\r
+> -    printf ("On %s, %s wrote:\n",\r
+> -            notmuch_message_get_header (node->envelope_file, "date"),\r
+> -            notmuch_message_get_header (node->envelope_file, "from"));\r
+> +    struct tm *info;\r
+> +    char dbuf[30];\r
+> +\r
+> +    info = localtime(notmuch_message_get_date(node->envelope_file));\r
+\r
+Close.  For whatever reason, localtime takes a pointer to a time_t,\r
+not a time_t (even though time_t is just a number).  You'll need\r
+something like\r
+\r
+time_t date;\r
+\r
+date = notmuch_message_get_date(node->envelope_file);\r
+info = localtime(&date);\r
+\r
+> +\r
+> +    strftime(dbuf, sizeof(dbuf), "%F %R %z", info);\r
+> +    printf ("* %s [%s]:\n",\r
+> +            notmuch_message_get_header(node->envelope_file, "from"), dbuf);\r
+> +\r
+>      } else if (GMIME_IS_MESSAGE (node->part)) {\r
+>      GMimeMessage *message = GMIME_MESSAGE (node->part);\r
+>      InternetAddressList *recipients;\r
+> \r
+> When compiling I get this warning:\r
+> \r
+> notmuch-reply.c: In function 'format_part_reply':\r
+> notmuch-reply.c:50: warning: passing argument 1 of 'localtime' makes pointer from integer without a cast\r
+\r
+Ah, C.  "I'm sure they meant for that number that looks nothing like a\r
+pointer to actually be a pointer that could corrupt memory, disclose\r
+private information, or crash the program.  I'll just convert it for\r
+them real quick..."\r
+\r
+> And a core dump when notmuch reply is invoked on a message. Am I even\r
+> close? :) Thanks\r