X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=bindings%2Fgo%2Fpkg%2Fnotmuch.go;h=de9de23c0e8cad21f4c587a574aac50ce696b451;hp=c6844ef9f3aa77ae7df292ea2e5c54233f6db771;hb=ce53850290e81ace34af5a1d418cc8941d0d3b8f;hpb=c234f8f972c13d1725da3152b114311350fea541 diff --git a/bindings/go/pkg/notmuch.go b/bindings/go/pkg/notmuch.go index c6844ef9..de9de23c 100644 --- a/bindings/go/pkg/notmuch.go +++ b/bindings/go/pkg/notmuch.go @@ -114,7 +114,7 @@ func NewDatabase(path string) *Database { * An existing notmuch database can be identified by the presence of a * directory named ".notmuch" below 'path'. * - * The caller should call notmuch_database_close when finished with + * The caller should call notmuch_database_destroy when finished with * this database. * * In case of any failure, this function returns NULL, (after printing @@ -140,7 +140,7 @@ func OpenDatabase(path string, mode DatabaseMode) *Database { /* Close the given notmuch database, freeing all associated * resources. See notmuch_database_open. */ func (self *Database) Close() { - C.notmuch_database_close(self.db) + C.notmuch_database_destroy(self.db) } /* Return the database path of the given database. @@ -306,20 +306,21 @@ func (self *Database) RemoveMessage(fname string) Status { * * An out-of-memory situation occurs * * A Xapian exception occurs */ -func (self *Database) FindMessage(message_id string) *Message { +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 + return nil, STATUS_OUT_OF_MEMORY } - msg := C.notmuch_database_find_message(self.db, c_msg_id) - if msg == nil { - return nil + 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 &Message{message:msg} + return msg, st } /* Return a list of all tags found in the database.