aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Austin Clements <amdragon@MIT.EDU>2012-11-24 23:57:06 -0500
committerGravatar David Bremner <bremner@debian.org>2013-05-05 13:56:39 -0300
commit45b9b55863efaf77248b9b64070cf0dc3bb2c008 (patch)
tree355b04a2c8e7f7a8fd299975ae236da9a9232041
parent44fe1f2c160eb333732465f051e5110adeab6b0a (diff)
python: Add bindings for notmuch_thread_get_messages
-rw-r--r--bindings/python/notmuch/thread.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/thread.py
index 009cb2bf..0454dbd4 100644
--- a/bindings/python/notmuch/thread.py
+++ b/bindings/python/notmuch/thread.py
@@ -128,11 +128,6 @@ class Thread(object):
in the thread. It will only iterate over the messages in the thread
which are not replies to other messages in the thread.
- To iterate over all messages in the thread, the caller will need to
- iterate over the result of :meth:`Message.get_replies` for each
- top-level message (and do that recursively for the resulting
- messages, etc.).
-
:returns: :class:`Messages`
:raises: :exc:`NotInitializedError` if query is not initialized
:raises: :exc:`NullPointerError` if search_messages failed
@@ -147,6 +142,28 @@ class Thread(object):
return Messages(msgs_p, self)
+ """notmuch_thread_get_messages"""
+ _get_messages = nmlib.notmuch_thread_get_messages
+ _get_messages.argtypes = [NotmuchThreadP]
+ _get_messages.restype = NotmuchMessagesP
+
+ def get_messages(self):
+ """Returns a :class:`Messages` iterator for all messages in 'thread'
+
+ :returns: :class:`Messages`
+ :raises: :exc:`NotInitializedError` if query is not initialized
+ :raises: :exc:`NullPointerError` if get_messages failed
+ """
+ if not self._thread:
+ raise NotInitializedError()
+
+ msgs_p = Thread._get_messages(self._thread)
+
+ if not msgs_p:
+ raise NullPointerError()
+
+ return Messages(msgs_p, self)
+
_get_matched_messages = nmlib.notmuch_thread_get_matched_messages
_get_matched_messages.argtypes = [NotmuchThreadP]
_get_matched_messages.restype = c_int