From: Julius Plenz Date: Sat, 2 Mar 2013 14:50:56 +0000 (+0100) Subject: [PATCH 3/3] Go bindings: Wrap (most) remaining notmuch thread functions X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=ca1a0f3b93939a5e8ca1f2d1b2311acd26ff8ec0;p=notmuch-archives.git [PATCH 3/3] Go bindings: Wrap (most) remaining notmuch thread functions --- diff --git a/17/078bf2dfa1c2add72d7885d969b9e59438db11 b/17/078bf2dfa1c2add72d7885d969b9e59438db11 new file mode 100644 index 000000000..dc2a8a391 --- /dev/null +++ b/17/078bf2dfa1c2add72d7885d969b9e59438db11 @@ -0,0 +1,153 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id CD636431FBF + for ; Sat, 2 Mar 2013 06:57:32 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 oLa2mW3eP5JU for ; + Sat, 2 Mar 2013 06:57:28 -0800 (PST) +Received: from noam.feh.name (noam.feh.name [176.9.34.52]) + by olra.theworths.org (Postfix) with ESMTP id EF19B431FBC + for ; Sat, 2 Mar 2013 06:57:27 -0800 (PST) +Received: by noam.feh.name (Postfix, from userid 1000) + id 51F60157C12F; Sat, 2 Mar 2013 15:51:19 +0100 (CET) +From: Julius Plenz +To: notmuch@notmuchmail.org +Subject: [PATCH 3/3] Go bindings: Wrap (most) remaining notmuch thread + functions +Date: Sat, 2 Mar 2013 15:50:56 +0100 +Message-Id: <1362235856-15358-3-git-send-email-julius@plenz.com> +X-Mailer: git-send-email 1.7.2.5 +In-Reply-To: <1362235856-15358-1-git-send-email-julius@plenz.com> +References: <1362235856-15358-1-git-send-email-julius@plenz.com> +X-Mailman-Approved-At: Sat, 02 Mar 2013 09:47:30 -0800 +Cc: Julius Plenz +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: Sat, 02 Mar 2013 14:57:33 -0000 + +--- + 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 +