1 Return-Path: <amdragon@mit.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id C7C7A431FBF
\r
6 for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 20:57:24 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id wTEjIsKdfJZv for <notmuch@notmuchmail.org>;
\r
16 Sat, 24 Nov 2012 20:57:20 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 726D6431FBD
\r
20 for <notmuch@notmuchmail.org>; Sat, 24 Nov 2012 20:57:19 -0800 (PST)
\r
21 X-AuditID: 1209190f-b7f636d00000095b-63-50b1a52e591f
\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])
\r
23 by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id DC.2B.02395.E25A1B05; Sat, 24 Nov 2012 23:57:18 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id qAP4vG10000523;
\r
27 Sat, 24 Nov 2012 23:57:16 -0500
\r
28 Received: from drake.dyndns.org
\r
29 (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com
\r
30 [209.6.116.242]) (authenticated bits=0)
\r
31 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
32 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qAP4vEGI000085
\r
33 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
34 Sat, 24 Nov 2012 23:57:16 -0500 (EST)
\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)
\r
36 (envelope-from <amdragon@mit.edu>)
\r
37 id 1TcUHJ-0003Zs-VB; Sat, 24 Nov 2012 23:57:13 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH 4/6] lib: Add an iterator over all messages in a thread
\r
41 Date: Sat, 24 Nov 2012 23:57:05 -0500
\r
42 Message-Id: <1353819427-13182-5-git-send-email-amdragon@mit.edu>
\r
43 X-Mailer: git-send-email 1.7.10.4
\r
44 In-Reply-To: <1353819427-13182-1-git-send-email-amdragon@mit.edu>
\r
45 References: <1353819427-13182-1-git-send-email-amdragon@mit.edu>
\r
46 X-Brightmail-Tracker:
\r
47 H4sIAAAAAAAAA+NgFtrOIsWRmVeSWpSXmKPExsUixCmqrKu3dGOAwfdrrBar5/JYXL85k9mB
\r
48 yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgynh64iZLwTuBirvnTzA3MD7n7WLk5JAQMJFo
\r
49 XtXHBGGLSVy4t54NxBYS2Mco8faUHYS9gVFiTZdbFyMXkP2ISeL09m5miMRcRonXe+pAbDYB
\r
50 DYlt+5czgtgiAtISO+/OZgWxmQUcJT7vXwQ0lINDWMBd4s1lPxCTRUBV4vgisCm8Ag4SE25f
\r
51 ZIY4QVGi+9kEsGpOoM7GvXIQixwkbv2bxDyBkX8BI8MqRtmU3Crd3MTMnOLUZN3i5MS8vNQi
\r
52 XRO93MwSvdSU0k2M4PCR5N/B+O2g0iFGAQ5GJR7eG4kbA4RYE8uKK3MPMUpyMCmJ8mYuAgrx
\r
53 JeWnVGYkFmfEF5XmpBYfYpTgYFYS4bVWBcrxpiRWVqUW5cOkpDlYlMR5r6bc9BcSSE8sSc1O
\r
54 TS1ILYLJynBwKEnwBi0BahQsSk1PrUjLzClBSDNxcIIM5wEaLgpSw1tckJhbnJkOkT/FqCgl
\r
55 zmsOkhAASWSU5sH1wuL7FaM40CvCvA4gVTzA1ADX/QpoMBPQ4Kez14EMLklESEk1MHrPXqzM
\r
56 xWijevHLJNVcfYmJyx4Flx7SSumLiO5d/p5tk6Deia2+e58/5bjJNOe8wpTIC7MNL+llnutZ
\r
57 fHiN9TdeliDm7S5OL39ouGYz7XS7NVnxzD/tT7au9YKRes0+Xg+etslnzJ0rrK/7w9p/u0/M
\r
58 W6vkg2m3nmgqHk8NzDvz6Qrb1Kj2K0osxRmJhlrMRcWJAGvN5J/KAgAA
\r
59 X-BeenThere: notmuch@notmuchmail.org
\r
60 X-Mailman-Version: 2.1.13
\r
62 List-Id: "Use and development of the notmuch mail system."
\r
63 <notmuch.notmuchmail.org>
\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
67 List-Post: <mailto:notmuch@notmuchmail.org>
\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
71 X-List-Received-Date: Sun, 25 Nov 2012 04:57:25 -0000
\r
73 Previously, getting the list of all messages in a thread required
\r
74 recursively traversing the thread's message hierarchy, which was both
\r
75 difficult and resulted in messages being out of order. This adds a
\r
76 public function to retrieve an iterator over all of the messages in a
\r
77 thread in oldest-first order.
\r
79 lib/notmuch.h | 13 +++++++------
\r
80 lib/thread.cc | 6 ++++++
\r
81 2 files changed, 13 insertions(+), 6 deletions(-)
\r
83 diff --git a/lib/notmuch.h b/lib/notmuch.h
\r
84 index 3633bed..3739336 100644
\r
87 @@ -719,20 +719,21 @@ int
\r
88 notmuch_thread_get_total_messages (notmuch_thread_t *thread);
\r
90 /* Get a notmuch_messages_t iterator for the top-level messages in
\r
92 + * 'thread' in oldest-first order.
\r
94 * This iterator will not necessarily iterate over all of the messages
\r
95 * in the thread. It will only iterate over the messages in the thread
\r
96 * which are not replies to other messages in the thread.
\r
98 - * To iterate over all messages in the thread, the caller will need to
\r
99 - * iterate over the result of notmuch_message_get_replies for each
\r
100 - * top-level message (and do that recursively for the resulting
\r
101 - * messages, etc.).
\r
103 notmuch_messages_t *
\r
104 notmuch_thread_get_toplevel_messages (notmuch_thread_t *thread);
\r
106 +/* Get a notmuch_thread_t iterator for all messages in 'thread' in
\r
107 + * oldest-first order.
\r
109 +notmuch_messages_t *
\r
110 +notmuch_thread_get_messages (notmuch_thread_t *thread);
\r
112 /* Get the number of messages in 'thread' that matched the search.
\r
114 * This count includes only the messages in this thread that were
\r
115 diff --git a/lib/thread.cc b/lib/thread.cc
\r
116 index 45a7d1d..c126aac 100644
\r
117 --- a/lib/thread.cc
\r
118 +++ b/lib/thread.cc
\r
119 @@ -508,6 +508,12 @@ notmuch_thread_get_toplevel_messages (notmuch_thread_t *thread)
\r
120 return _notmuch_messages_create (thread->toplevel_list);
\r
123 +notmuch_messages_t *
\r
124 +notmuch_thread_get_messages (notmuch_thread_t *thread)
\r
126 + return _notmuch_messages_create (thread->message_list);
\r
130 notmuch_thread_get_thread_id (notmuch_thread_t *thread)
\r