Exemplo n.º 1
0
/* Return a list of tags from all messages.
 *
 * The resulting list is guaranteed not to contain duplicated tags.
 *
 * WARNING: You can no longer iterate over messages after calling this
 * function, because the iterator will point at the end of the list.
 * We do not have a function to reset the iterator yet and the only
 * way how you can iterate over the list again is to recreate the
 * message list.
 *
 * The function returns NULL on error.
 */
func (self *Messages) CollectTags() *Tags {
	if self.messages == nil {
		return nil
	}
	tags := C.notmuch_messages_collect_tags(self.messages)
	if tags == nil {
		return nil
	}
	return &Tags{tags: tags}
}
Exemplo n.º 2
0
// Tags return a list of tags from all messages.
//
// WARNING: You can no longer iterate over messages after calling this
// function, because the iterator will point at the end of the list.  We do not
// have a function to reset the iterator yet and the only way how you can
// iterate over the list again is to recreate the message list.
func (ms *Messages) Tags() *Tags {
	ctags := C.notmuch_messages_collect_tags(ms.toC())
	// TODO(kalbasit): notmuch_messages_collect_tags can return NULL on error
	// but there's not explanation on what kind of error can occur. We should handle
	// it as OOM for now but we eventually have to narrow it down.
	checkOOM(unsafe.Pointer(ctags))
	tags := &Tags{
		cptr:   unsafe.Pointer(ctags),
		parent: (*cStruct)(ms),
	}
	setGcClose(tags)
	return tags
}