[PATCH v2] go: add binding for notmuch_message_get_date

Trevor Jim tjim at mac.com
Sat Mar 7 12:23:51 PST 2015


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

diff --git a/bindings/go/src/notmuch/notmuch.go b/bindings/go/src/notmuch/notmuch.go
index b9230ad..5857b67 100644
--- a/bindings/go/src/notmuch/notmuch.go
+++ b/bindings/go/src/notmuch/notmuch.go
@@ -801,7 +801,22 @@ 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
+/* Get the timestamp (seconds since the epoch) of 'message'.
+ *
+ * Return status:
+ *
+ * NOTMUCH_STATUS_SUCCESS: Timestamp successfully retrieved
+ *
+ * NOTMUCH_STATUS_NULL_POINTER: The 'message' argument is NULL
+ * 
+ */
+func (self *Message) GetDate() (int64, Status) {
+	if self.message == nil {
+		return -1, STATUS_NULL_POINTER
+	}
+	timestamp := C.notmuch_message_get_date(self.message)
+	return int64(timestamp), STATUS_SUCCESS
+}
 
 /* Get the value of the specified header from 'message'.
  *
-- 
2.2.2



More information about the notmuch mailing list