[PATCH] test/thread-order: more robust loop exit in case of broken input
[notmuch-archives.git] / 17 / 078bf2dfa1c2add72d7885d969b9e59438db11
1 Return-Path: <feh@noam.feh.name>\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 CD636431FBF\r
6         for <notmuch@notmuchmail.org>; Sat,  2 Mar 2013 06:57:32 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 oLa2mW3eP5JU for <notmuch@notmuchmail.org>;\r
16         Sat,  2 Mar 2013 06:57:28 -0800 (PST)\r
17 Received: from noam.feh.name (noam.feh.name [176.9.34.52])\r
18         by olra.theworths.org (Postfix) with ESMTP id EF19B431FBC\r
19         for <notmuch@notmuchmail.org>; Sat,  2 Mar 2013 06:57:27 -0800 (PST)\r
20 Received: by noam.feh.name (Postfix, from userid 1000)\r
21         id 51F60157C12F; Sat,  2 Mar 2013 15:51:19 +0100 (CET)\r
22 From: Julius Plenz <julius@plenz.com>\r
23 To: notmuch@notmuchmail.org\r
24 Subject: [PATCH 3/3] Go bindings: Wrap (most) remaining notmuch thread\r
25         functions\r
26 Date: Sat,  2 Mar 2013 15:50:56 +0100\r
27 Message-Id: <1362235856-15358-3-git-send-email-julius@plenz.com>\r
28 X-Mailer: git-send-email 1.7.2.5\r
29 In-Reply-To: <1362235856-15358-1-git-send-email-julius@plenz.com>\r
30 References: <1362235856-15358-1-git-send-email-julius@plenz.com>\r
31 X-Mailman-Approved-At: Sat, 02 Mar 2013 09:47:30 -0800\r
32 Cc: Julius Plenz <julius@plenz.com>\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.13\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37         <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
39         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Sat, 02 Mar 2013 14:57:33 -0000\r
46 \r
47 ---\r
48  bindings/go/src/notmuch/notmuch.go |   89 +++++++++++++++++++++++++++++++++++-\r
49  1 file changed, 88 insertions(+), 1 deletion(-)\r
50 \r
51 diff --git a/bindings/go/src/notmuch/notmuch.go b/bindings/go/src/notmuch/notmuch.go\r
52 index 306b104..8829f82 100644\r
53 --- a/bindings/go/src/notmuch/notmuch.go\r
54 +++ b/bindings/go/src/notmuch/notmuch.go\r
55 @@ -385,7 +385,94 @@ func (self *Query) CountMessages() uint {\r
56         return uint(C.notmuch_query_count_messages(self.query))\r
57  }\r
58  \r
59 -// TODO: wrap threads and thread\r
60 +func (self *Thread) GetToplevelMessages() *Messages {\r
61 +       if self.thread == nil {\r
62 +               return nil\r
63 +       }\r
64 +       msgs := C.notmuch_thread_get_toplevel_messages(self.thread)\r
65 +       if msgs == nil {\r
66 +               return nil\r
67 +       }\r
68 +       return &Messages{messages: msgs}\r
69 +}\r
70 +\r
71 +func (self *Thread) GetThreadId() string {\r
72 +       if self.thread == nil {\r
73 +               return ""\r
74 +       }\r
75 +       id := C.notmuch_thread_get_thread_id(self.thread)\r
76 +       if id == nil {\r
77 +               return ""\r
78 +       }\r
79 +       return C.GoString(id)\r
80 +}\r
81 +\r
82 +func (self *Thread) GetTotalMessages() uint {\r
83 +       if self.thread == nil {\r
84 +               return 0\r
85 +       }\r
86 +       return uint(C.notmuch_thread_get_total_messages(self.thread))\r
87 +}\r
88 +\r
89 +func (self *Thread) GetMatchedMessages() uint {\r
90 +       if self.thread == nil {\r
91 +               return 0\r
92 +       }\r
93 +       return uint(C.notmuch_thread_get_matched_messages(self.thread))\r
94 +}\r
95 +\r
96 +func (self *Thread) GetAuthors() string {\r
97 +       if self.thread == nil {\r
98 +               return ""\r
99 +       }\r
100 +       authors := C.notmuch_thread_get_authors(self.thread)\r
101 +       if authors == nil {\r
102 +               return ""\r
103 +       }\r
104 +       return C.GoString(authors)\r
105 +}\r
106 +\r
107 +func (self *Thread) GetSubject() string {\r
108 +       if self.thread == nil {\r
109 +               return ""\r
110 +       }\r
111 +       subject := C.notmuch_thread_get_subject(self.thread)\r
112 +       if subject == nil {\r
113 +               return ""\r
114 +       }\r
115 +       return C.GoString(subject)\r
116 +}\r
117 +\r
118 +func (self *Threads) MoveToNext() {\r
119 +       if self.threads == nil {\r
120 +               return\r
121 +       }\r
122 +       C.notmuch_threads_move_to_next(self.threads)\r
123 +}\r
124 +\r
125 +func (self *Threads) Get() *Thread {\r
126 +       if self.threads == nil {\r
127 +               return nil\r
128 +       }\r
129 +       t := C.notmuch_threads_get(self.threads)\r
130 +       if t == nil {\r
131 +               return nil\r
132 +       }\r
133 +       return &Thread{thread: t}\r
134 +}\r
135 +\r
136 +// TODO: notmuch_thread_get_oldest_date and notmuch_thread_get_newest_date\r
137 +\r
138 +func (self *Thread) GetTags() *Tags {\r
139 +       if self.thread == nil {\r
140 +               return nil\r
141 +       }\r
142 +       tags := C.notmuch_thread_get_tags(self.thread)\r
143 +       if tags == nil {\r
144 +               return nil\r
145 +       }\r
146 +       return &Tags{tags: tags}\r
147 +}\r
148  \r
149  func (self *Threads) Valid() bool {\r
150         if self.threads == nil {\r
151 -- \r
152 1.7.10.4\r
153 \r