From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Wed, 9 May 2012 10:23:06 +0000 (+0200) Subject: [PATCH 1/3] go: update notmuch-addrlookup to the new API X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=46bffd8424702cb84f8001d063e9f7ed6d9bee75;p=notmuch-archives.git [PATCH 1/3] go: update notmuch-addrlookup to the new API --- diff --git a/22/3eba56dc40e23ad53cec60452486d59f9971d2 b/22/3eba56dc40e23ad53cec60452486d59f9971d2 new file mode 100644 index 000000000..3d2a1ccde --- /dev/null +++ b/22/3eba56dc40e23ad53cec60452486d59f9971d2 @@ -0,0 +1,91 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id B5722431FBF + for ; Wed, 9 May 2012 03:23:36 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id qo7ikvcxs8QO for ; + Wed, 9 May 2012 03:23:36 -0700 (PDT) +Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 35205431FB6 + for ; Wed, 9 May 2012 03:23:35 -0700 (PDT) +Received: from mail.jade-hamburg.de (mail.jade-hamburg.de [85.183.11.228]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.cryptobitch.de (Postfix) with ESMTPSA id 974525885CB + for ; Wed, 9 May 2012 12:23:33 +0200 (CEST) +Received: by mail.jade-hamburg.de (Postfix, from userid 401) + id 8A1ECDF2A5; Wed, 9 May 2012 12:23:16 +0200 (CEST) +Received: from thinkbox.jade-hamburg.de (mail.jade-hamburg.de [85.183.11.228]) + (using TLSv1 with cipher AES256-SHA (256/256 bits)) + (No client certificate requested) (Authenticated sender: teythoon) + by mail.jade-hamburg.de (Postfix) with ESMTPSA id ADC7BDF2A2; + Wed, 9 May 2012 12:23:10 +0200 (CEST) +Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.77) + (envelope-from ) + id 1SS43I-0001rq-6F; Wed, 09 May 2012 12:23:24 +0200 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +To: notmuch@notmuchmail.org +Subject: [PATCH 1/3] go: update notmuch-addrlookup to the new API +Date: Wed, 9 May 2012 12:23:06 +0200 +Message-Id: + <1336558988-6813-2-git-send-email-4winter@informatik.uni-hamburg.de> +X-Mailer: git-send-email 1.7.10 +In-Reply-To: + <1336558988-6813-1-git-send-email-4winter@informatik.uni-hamburg.de> +References: + <1336558988-6813-1-git-send-email-4winter@informatik.uni-hamburg.de> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 09 May 2012 10:23:37 -0000 + +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 | 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 +