[PATCH 2/3] Go bindings: wrap notmuch_message_get_date

Julius Plenz julius at plenz.com
Sat Mar 2 06:50:55 PST 2013


---
 bindings/go/src/notmuch/notmuch.go |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/bindings/go/src/notmuch/notmuch.go b/bindings/go/src/notmuch/notmuch.go
index 0bdbba9..306b104 100644
--- a/bindings/go/src/notmuch/notmuch.go
+++ b/bindings/go/src/notmuch/notmuch.go
@@ -12,6 +12,7 @@ package notmuch
 */
 import "C"
 import "unsafe"
+import "time"
 
 // Status codes used for the return values of most functions
 type Status C.notmuch_status_t
@@ -559,7 +560,12 @@ func (self *Message) SetFlag(flag Flag, value bool) {
 	C.notmuch_message_set_flag(self.message, C.notmuch_message_flag_t(flag), v)
 }
 
-// TODO: wrap notmuch_message_get_date
+func (self *Message) GetDate() time.Time {
+	if self.message == nil {
+		return time.Unix(0, 0)
+	}
+	return time.Unix(int64(C.notmuch_message_get_date(self.message)), 0)
+}
 
 // Get the value of the specified header from the message. The value
 // will be read from the actual message file, not from the notmuch
-- 
1.7.10.4



More information about the notmuch mailing list