]> git.notmuchmail.org Git - notmuch/commitdiff
go: add binding for notmuch_message_get_date
authorTrevor Jim <tjim@mac.com>
Sat, 7 Mar 2015 20:23:51 +0000 (15:23 -0500)
committerDavid Bremner <david@tethera.net>
Sun, 8 Mar 2015 07:25:44 +0000 (08:25 +0100)
bindings/go/src/notmuch/notmuch.go

index b9230ad2c3455852724b3ea6b3ed2287acb65ecb..0fff1ab63fb0acccd58d9a5eeea8b45bb3e241b4 100644 (file)
@@ -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'.
  *