summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Spaeth <sebastian@sspaeth.de>2010-03-19 09:46:44 +0100
committerSebastian Spaeth <sebastian@sspaeth.de>2010-03-19 09:46:44 +0100
commitb42fdb0f70c23d72b0c7e91c6e09f48192a8206c (patch)
tree487ade5d61171735b01e4ecaf3f91af477402b3e
parentcd109ef55916389c481fc6974a4739fdf1899c32 (diff)
implement Message.get_thread_id()
-rw-r--r--cnotmuch/database.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/cnotmuch/database.py b/cnotmuch/database.py
index 6a118bd..0ae24ec 100644
--- a/cnotmuch/database.py
+++ b/cnotmuch/database.py
@@ -620,10 +620,15 @@ class Message(object):
"""notmuch_message_get_filename (notmuch_message_t *message)"""
_get_filename = nmlib.notmuch_message_get_filename
_get_filename.restype = c_char_p
+
"""notmuch_message_get_message_id (notmuch_message_t *message)"""
_get_message_id = nmlib.notmuch_message_get_message_id
_get_message_id.restype = c_char_p
+ """notmuch_message_get_thread_id"""
+ _get_thread_id = nmlib.notmuch_message_get_thread_id
+ _get_thread_id.restype = c_char_p
+
"""notmuch_message_get_tags (notmuch_message_t *message)"""
_get_tags = nmlib.notmuch_message_get_tags
_get_tags.restype = c_void_p
@@ -653,7 +658,7 @@ class Message(object):
def get_message_id(self):
- """Return the message ID
+ """Returns the message ID
:returns: String with a message ID
:exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the message
@@ -663,6 +668,24 @@ class Message(object):
raise NotmuchError(STATUS.NOT_INITIALIZED)
return Message._get_message_id(self._msg)
+ def get_thread_id(self):
+ """Returns the thread ID
+
+ The returned string belongs to 'message' will only be valid for as
+ long as the message is valid.
+
+ This function will not return None since Notmuch ensures that every
+ message belongs to a single thread.
+
+ :returns: String with a thread ID
+ :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_thread_id (self._msg);
+
def get_date(self):
"""Returns time_t of the message date