Beispiel #1
0
/**
 * Get the authors of 'thread' as a UTF-8 string.
 *
 * The returned string is a comma-separated list of the names of the
 * authors of mail messages in the query results that belong to this
 * thread.
 *
 * The string contains authors of messages matching the query first, then
 * non-matched authors (with the two groups separated by '|'). Within
 * each group, authors are ordered by date.
 *
 * The returned string belongs to 'thread' and as such, should not be
 * modified by the caller and will only be valid for as long as the
 * thread is valid, (which is until notmuch_thread_destroy or until
 * the query from which it derived is destroyed).
 */
func (self *Thread) GetAuthors() string {
	if self.thread == nil {
		return ""
	}
	str := C.notmuch_thread_get_authors(self.thread)
	if str == nil {
		return ""
	}
	return C.GoString(str)
}
Beispiel #2
0
// Authors returns the list of authors, the first are the authors that matched
// the query whilst the second return are the rest of the authors. All authors
// are ordered by date.
func (t *Thread) Authors() ([]string, []string) {
	var matched, unmatched []string

	as := C.GoString(C.notmuch_thread_get_authors(t.toC()))
	munm := strings.Split(as, "|")
	if len(munm) > 1 {
		matched = strings.Split(munm[0], ",")
		unmatched = strings.Split(munm[1], ",")
	} else {
		unmatched = strings.Split(munm[0], ",")
	}
	for i, s := range matched {
		matched[i] = strings.Trim(s, " ")
	}
	for i, s := range unmatched {
		unmatched[i] = strings.Trim(s, " ")
	}
	return matched, unmatched
}