From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id A1254431FBF for ; Sat, 24 Nov 2012 20:57:30 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id C7J32gvhB2VQ for ; Sat, 24 Nov 2012 20:57:29 -0800 (PST) Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU [18.7.68.34]) by olra.theworths.org (Postfix) with ESMTP id 186CA431FAF for ; Sat, 24 Nov 2012 20:57:28 -0800 (PST) X-AuditID: 12074422-b7f746d0000008cc-d2-50b1a5374951 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP id DA.9A.02252.735A1B05; Sat, 24 Nov 2012 23:57:27 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id qAP4vGOc018856; Sat, 24 Nov 2012 23:57:16 -0500 Received: from drake.dyndns.org (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [209.6.116.242]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qAP4vEUg000086 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 24 Nov 2012 23:57:16 -0500 (EST) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1TcUHK-0003Zv-04; Sat, 24 Nov 2012 23:57:13 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 5/6] python: Add bindings for notmuch_thread_get_messages Date: Sat, 24 Nov 2012 23:57:06 -0500 Message-Id: <1353819427-13182-6-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1353819427-13182-1-git-send-email-amdragon@mit.edu> References: <1353819427-13182-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRmVeSWpSXmKPExsUixCmqrWu+dGOAwbeNOhar5/JYXL85k9mB yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgyjg7cSljwRH+isXrn7I3MD7n7mLk5JAQMJH4 cnY2M4QtJnHh3nq2LkYuDiGBfYwSna+3skI4Gxgldn75xwpSJSTwiEli3oZYiMRcRomXf2eB tbMJaEhs27+cEcQWEZCW2Hl3NlgDs4CjxOf9i9hAbGEBT4nd/dtYuhg5OFgEVCWWdeeBhHkF HCTuv77CBnGFokT3swlsICWcQK2Ne+Ug1jpI3Po3iXkCI/8CRoZVjLIpuVW6uYmZOcWpybrF yYl5ealFuqZ6uZkleqkppZsYQUHE7qK0g/HnQaVDjAIcjEo8vDcSNwYIsSaWFVfmHmKU5GBS EuXNXAQU4kvKT6nMSCzOiC8qzUktPsQowcGsJMJrrQqU401JrKxKLcqHSUlzsCiJ815Luekv JJCeWJKanZpakFoEk5Xh4FCS4J28BKhRsCg1PbUiLTOnBCHNxMEJMpwHaLgoSA1vcUFibnFm OkT+FKOilDhvA0hCACSRUZoH1wuL8leM4kCvCPPWgVTxABMEXPcroMFMQIOfzl4HMrgkESEl 1cA4xTc58+LuuiP7by0N+8QQuiTuu80nM8+3/3g3Bk6uLrnjpmLwIGfLzem531c0OMoeOGK9 QyY7vffB0U/8S3Z0/en5Xd0gwP40S8d7ueiba1Es9X/L/n5La1kmvjRNP1DqxtwTngXPeaX/ 3r695cq383E/1zD5KTttDvLVfxp87vKrZSUy60oeKbEUZyQaajEXFScCAOJnGhPNAgAA X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Nov 2012 04:57:31 -0000 --- bindings/python/notmuch/thread.py | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/thread.py index 009cb2b..0454dbd 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 -- 1.7.10.4