[PATCH 5/5] python: add get_mtime() to the Message class

Thomas Jost schnouki at schnouki.net
Tue Dec 13 09:11:45 PST 2011


---
 bindings/python/notmuch/message.py |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/message.py
index ce8e718..56f56c2 100644
--- a/bindings/python/notmuch/message.py
+++ b/bindings/python/notmuch/message.py
@@ -293,6 +293,10 @@ class Message(object):
     _get_date.argtypes = [NotmuchMessageP]
     _get_date.restype = c_long
 
+    _get_mtime = nmlib.notmuch_message_get_mtime
+    _get_mtime.argtypes = [NotmuchMessageP]
+    _get_mtime.restype = c_long
+
     _get_header = nmlib.notmuch_message_get_header
     _get_header.argtypes = [NotmuchMessageP, c_char_p]
     _get_header.restype = c_char_p
@@ -401,6 +405,22 @@ class Message(object):
             raise NotmuchError(STATUS.NOT_INITIALIZED)
         return Message._get_date(self._msg)
 
+    def get_mtime(self):
+        """Returns time_t of the message mtime
+
+        The mtime is the timestamp of the last time the message was modified,
+        e.g. the time it was added to the database or the last time a tag was
+        added or removed.
+
+        :returns: A time_t timestamp.
+        :rtype: c_unit64
+        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
+                    is not initialized.
+        """
+        if self._msg is None:
+            raise NotmuchError(STATUS.NOT_INITIALIZED)
+        return Message._get_mtime(self._msg)
+
     def get_header(self, header):
         """Get the value of the specified header.
 
-- 
1.7.8



More information about the notmuch mailing list