[PATCH 2/3] Go bindings: wrap notmuch_message_get_date
authorJulius Plenz <julius@plenz.com>
Sat, 2 Mar 2013 14:50:55 +0000 (15:50 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:53:49 +0000 (09:53 -0800)
cd/3660c2ca0c5ea85fc56ca1065db400f14cb7f8 [new file with mode: 0644]

diff --git a/cd/3660c2ca0c5ea85fc56ca1065db400f14cb7f8 b/cd/3660c2ca0c5ea85fc56ca1065db400f14cb7f8
new file mode 100644 (file)
index 0000000..941c07d
--- /dev/null
@@ -0,0 +1,78 @@
+Return-Path: <feh@noam.feh.name>\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 D9C9D431FC0\r
+       for <notmuch@notmuchmail.org>; Sat,  2 Mar 2013 06:57:32 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\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 pB1vhf9e3ahN for <notmuch@notmuchmail.org>;\r
+       Sat,  2 Mar 2013 06:57:28 -0800 (PST)\r
+Received: from noam.feh.name (noam.feh.name [176.9.34.52])\r
+       by olra.theworths.org (Postfix) with ESMTP id F187C431FBD\r
+       for <notmuch@notmuchmail.org>; Sat,  2 Mar 2013 06:57:27 -0800 (PST)\r
+Received: by noam.feh.name (Postfix, from userid 1000)\r
+       id 5EC23157C12E; Sat,  2 Mar 2013 15:51:18 +0100 (CET)\r
+From: Julius Plenz <julius@plenz.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/3] Go bindings: wrap notmuch_message_get_date\r
+Date: Sat,  2 Mar 2013 15:50:55 +0100\r
+Message-Id: <1362235856-15358-2-git-send-email-julius@plenz.com>\r
+X-Mailer: git-send-email 1.7.2.5\r
+In-Reply-To: <1362235856-15358-1-git-send-email-julius@plenz.com>\r
+References: <1362235856-15358-1-git-send-email-julius@plenz.com>\r
+X-Mailman-Approved-At: Sat, 02 Mar 2013 09:47:30 -0800\r
+Cc: Julius Plenz <julius@plenz.com>\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: Sat, 02 Mar 2013 14:57:33 -0000\r
+\r
+---\r
+ bindings/go/src/notmuch/notmuch.go |    8 +++++++-\r
+ 1 file changed, 7 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/bindings/go/src/notmuch/notmuch.go b/bindings/go/src/notmuch/notmuch.go\r
+index 0bdbba9..306b104 100644\r
+--- a/bindings/go/src/notmuch/notmuch.go\r
++++ b/bindings/go/src/notmuch/notmuch.go\r
+@@ -12,6 +12,7 @@ package notmuch\r
+ */\r
+ import "C"\r
+ import "unsafe"\r
++import "time"\r
\r
+ // Status codes used for the return values of most functions\r
+ type Status C.notmuch_status_t\r
+@@ -559,7 +560,12 @@ func (self *Message) SetFlag(flag Flag, value bool) {\r
+       C.notmuch_message_set_flag(self.message, C.notmuch_message_flag_t(flag), v)\r
+ }\r
\r
+-// TODO: wrap notmuch_message_get_date\r
++func (self *Message) GetDate() time.Time {\r
++      if self.message == nil {\r
++              return time.Unix(0, 0)\r
++      }\r
++      return time.Unix(int64(C.notmuch_message_get_date(self.message)), 0)\r
++}\r
\r
+ // Get the value of the specified header from the message. The value\r
+ // will be read from the actual message file, not from the notmuch\r
+-- \r
+1.7.10.4\r
+\r