unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Julius Plenz <julius@plenz.com>
To: notmuch@notmuchmail.org
Cc: Julius Plenz <julius@plenz.com>
Subject: [PATCH 3/3] Go bindings: Wrap (most) remaining notmuch thread functions
Date: Sat,  2 Mar 2013 15:50:56 +0100	[thread overview]
Message-ID: <1362235856-15358-3-git-send-email-julius@plenz.com> (raw)
In-Reply-To: <1362235856-15358-1-git-send-email-julius@plenz.com>

---
 bindings/go/src/notmuch/notmuch.go |   89 +++++++++++++++++++++++++++++++++++-
 1 file changed, 88 insertions(+), 1 deletion(-)

diff --git a/bindings/go/src/notmuch/notmuch.go b/bindings/go/src/notmuch/notmuch.go
index 306b104..8829f82 100644
--- a/bindings/go/src/notmuch/notmuch.go
+++ b/bindings/go/src/notmuch/notmuch.go
@@ -385,7 +385,94 @@ func (self *Query) CountMessages() uint {
 	return uint(C.notmuch_query_count_messages(self.query))
 }
 
-// TODO: wrap threads and thread
+func (self *Thread) GetToplevelMessages() *Messages {
+	if self.thread == nil {
+		return nil
+	}
+	msgs := C.notmuch_thread_get_toplevel_messages(self.thread)
+	if msgs == nil {
+		return nil
+	}
+	return &Messages{messages: msgs}
+}
+
+func (self *Thread) GetThreadId() string {
+	if self.thread == nil {
+		return ""
+	}
+	id := C.notmuch_thread_get_thread_id(self.thread)
+	if id == nil {
+		return ""
+	}
+	return C.GoString(id)
+}
+
+func (self *Thread) GetTotalMessages() uint {
+	if self.thread == nil {
+		return 0
+	}
+	return uint(C.notmuch_thread_get_total_messages(self.thread))
+}
+
+func (self *Thread) GetMatchedMessages() uint {
+	if self.thread == nil {
+		return 0
+	}
+	return uint(C.notmuch_thread_get_matched_messages(self.thread))
+}
+
+func (self *Thread) GetAuthors() string {
+	if self.thread == nil {
+		return ""
+	}
+	authors := C.notmuch_thread_get_authors(self.thread)
+	if authors == nil {
+		return ""
+	}
+	return C.GoString(authors)
+}
+
+func (self *Thread) GetSubject() string {
+	if self.thread == nil {
+		return ""
+	}
+	subject := C.notmuch_thread_get_subject(self.thread)
+	if subject == nil {
+		return ""
+	}
+	return C.GoString(subject)
+}
+
+func (self *Threads) MoveToNext() {
+	if self.threads == nil {
+		return
+	}
+	C.notmuch_threads_move_to_next(self.threads)
+}
+
+func (self *Threads) Get() *Thread {
+	if self.threads == nil {
+		return nil
+	}
+	t := C.notmuch_threads_get(self.threads)
+	if t == nil {
+		return nil
+	}
+	return &Thread{thread: t}
+}
+
+// TODO: notmuch_thread_get_oldest_date and notmuch_thread_get_newest_date
+
+func (self *Thread) GetTags() *Tags {
+	if self.thread == nil {
+		return nil
+	}
+	tags := C.notmuch_thread_get_tags(self.thread)
+	if tags == nil {
+		return nil
+	}
+	return &Tags{tags: tags}
+}
 
 func (self *Threads) Valid() bool {
 	if self.threads == nil {
-- 
1.7.10.4

  parent reply	other threads:[~2013-03-02 14:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-02 14:50 [PATCH 1/3] Go bindings: clean up the documentation Julius Plenz
2013-03-02 14:50 ` [PATCH 2/3] Go bindings: wrap notmuch_message_get_date Julius Plenz
2013-03-02 18:29   ` Justus Winter
2013-03-02 14:50 ` Julius Plenz [this message]
2013-03-02 18:26 ` [PATCH 1/3] Go bindings: clean up the documentation Justus Winter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362235856-15358-3-git-send-email-julius@plenz.com \
    --to=julius@plenz.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).