]> git.cworth.org Git - obsolete/notmuch-old/commitdiff
go: update notmuch-addrlookup to the new API
authorJustus Winter <4winter@informatik.uni-hamburg.de>
Wed, 9 May 2012 10:23:06 +0000 (12:23 +0200)
committerDavid Bremner <bremner@debian.org>
Fri, 11 May 2012 11:28:06 +0000 (08:28 -0300)
notmuch.OpenDatabase now returns a status indicating success or
failure. Use this information to inform the user of any failures.

Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
bindings/go/cmds/notmuch-addrlookup.go

index 16958e502e4e1979ef962908729d7ae222f23cf0..03699fb488672d8b2e4091f17b6a814fd0d5726b 100644 (file)
@@ -209,8 +209,12 @@ func (self *address_matcher) run(name string) {
        queries := [3]*notmuch.Query{}
        
        // open the database
-       self.db = notmuch.OpenDatabase(self.user_db_path, 
-               notmuch.DATABASE_MODE_READ_ONLY)
+       if db, status := notmuch.OpenDatabase(self.user_db_path,
+               notmuch.DATABASE_MODE_READ_ONLY); status == notmuch.STATUS_SUCCESS {
+        self.db = db
+       } else {
+               log.Fatalf("Failed to open the database: %v\n", status)
+       }
 
        // pass 1: look at all from: addresses with the address book tag
        query := "tag:" + self.user_addrbook_tag