/* Find a message with the given message_id. * * If the database contains a message with the given message_id, then * a new notmuch_message_t object is returned. The caller should call * notmuch_message_destroy when done with the message. * * This function returns NULL in the following situations: * * * No message is found with the given message_id * * An out-of-memory situation occurs * * A Xapian exception occurs */ func (self *Database) FindMessage(message_id string) (*Message, Status) { var c_msg_id *C.char = C.CString(message_id) defer C.free(unsafe.Pointer(c_msg_id)) if c_msg_id == nil { return nil, STATUS_OUT_OF_MEMORY } msg := &Message{message: nil} st := Status(C.notmuch_database_find_message(self.db, c_msg_id, &msg.message)) if st != STATUS_SUCCESS { return nil, st } return msg, st }
// FindMessage finds a message with the given message_id. func (db *DB) FindMessage(id string) (*Message, error) { cid := C.CString(id) defer C.free(unsafe.Pointer(cid)) var cmsg *C.notmuch_message_t if err := statusErr(C.notmuch_database_find_message(db.toC(), cid, &cmsg)); err != nil { return nil, err } if cmsg == nil { return nil, ErrNotFound } msg := &Message{ cptr: unsafe.Pointer(cmsg), parent: (*cStruct)(db), } setGcClose(msg) return msg, nil }