[PATCH 1/3] go: update notmuch-addrlookup to the new API

2012-05-09 Thread Justus Winter
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 at informatik.uni-hamburg.de>
---
 bindings/go/cmds/notmuch-addrlookup.go |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/bindings/go/cmds/notmuch-addrlookup.go 
b/bindings/go/cmds/notmuch-addrlookup.go
index 16958e5..03699fb 100644
--- a/bindings/go/cmds/notmuch-addrlookup.go
+++ b/bindings/go/cmds/notmuch-addrlookup.go
@@ -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
-- 
1.7.10



[PATCH 1/3] go: update notmuch-addrlookup to the new API

2012-05-09 Thread Justus Winter
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 4win...@informatik.uni-hamburg.de
---
 bindings/go/cmds/notmuch-addrlookup.go |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/bindings/go/cmds/notmuch-addrlookup.go 
b/bindings/go/cmds/notmuch-addrlookup.go
index 16958e5..03699fb 100644
--- a/bindings/go/cmds/notmuch-addrlookup.go
+++ b/bindings/go/cmds/notmuch-addrlookup.go
@@ -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
-- 
1.7.10

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch