Esempio n. 1
0
/* Get a notmuch_messages_t iterator for all of the replies to
 * 'message'.
 *
 * Note: This call only makes sense if 'message' was ultimately
 * obtained from a notmuch_thread_t object, (such as by coming
 * directly from the result of calling notmuch_thread_get_
 * toplevel_messages or by any number of subsequent
 * calls to notmuch_message_get_replies).
 *
 * If 'message' was obtained through some non-thread means, (such as
 * by a call to notmuch_query_search_messages), then this function
 * will return NULL.
 *
 * If there are no replies to 'message', this function will return
 * NULL. (Note that notmuch_messages_valid will accept that NULL
 * value as legitimate, and simply return FALSE for it.)
 */
func (self *Message) GetReplies() *Messages {
	if self.message == nil {
		return nil
	}
	msgs := C.notmuch_message_get_replies(self.message)
	if msgs == nil {
		return nil
	}
	return &Messages{messages: msgs}
}
Esempio n. 2
0
// Replies returns the replies of a message.
func (m *Message) Replies() (*Messages, error) {
	cmsgs := C.notmuch_message_get_replies(m.toC())
	if unsafe.Pointer(cmsgs) == nil {
		return nil, ErrNoRepliesOrPointerNotFromThread
	}
	// We point the messages object directly at our thread, rather than having
	// the gc reference go through this message:
	msgs := &Messages{
		cptr:   unsafe.Pointer(cmsgs),
		parent: (*cStruct)(m),
	}
	setGcClose(msgs)
	return msgs, nil
}