[PATCH] go: Update to the current notmuch_database_find_message API
authorAustin Clements <amdragon@MIT.EDU>
Sat, 28 Apr 2012 21:45:18 +0000 (17:45 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:46 +0000 (09:46 -0800)
34/7db57008b726fc1af512d225ac6ed7f2ac152b [new file with mode: 0644]

diff --git a/34/7db57008b726fc1af512d225ac6ed7f2ac152b b/34/7db57008b726fc1af512d225ac6ed7f2ac152b
new file mode 100644 (file)
index 0000000..488b035
--- /dev/null
@@ -0,0 +1,113 @@
+Return-Path: <amthrax@drake.mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id E140E431FAF\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Apr 2012 14:45:23 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id s4yDpDqO8SYd for <notmuch@notmuchmail.org>;\r
+       Sat, 28 Apr 2012 14:45:23 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
+       [18.7.68.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 4EB9B431FAE\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Apr 2012 14:45:23 -0700 (PDT)\r
+X-AuditID: 12074422-b7fd66d0000008f9-b6-4f9c64f23af2\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 8A.7D.02297.2F46C9F4; Sat, 28 Apr 2012 17:45:22 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q3SLjLAB005494; \r
+       Sat, 28 Apr 2012 17:45:21 -0400\r
+Received: from drake.mit.edu\r
+       (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [209.6.116.242]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q3SLjK9o005936\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sat, 28 Apr 2012 17:45:21 -0400 (EDT)\r
+Received: from amthrax by drake.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amthrax@drake.mit.edu>)\r
+       id 1SOFSB-0000X1-UQ; Sat, 28 Apr 2012 17:45:20 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] go: Update to the current notmuch_database_find_message API\r
+Date: Sat, 28 Apr 2012 17:45:18 -0400\r
+Message-Id: <1335649518-1970-1-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.9.1\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFprFIsWRmVeSWpSXmKPExsUixG6nrvspZY6/wZUVshbXb85kdmD0eLbq\r
+       FnMAYxSXTUpqTmZZapG+XQJXxv0TtxgL2rgrzvy6ztzA+J+ji5GDQ0LARGLzTO8uRk4gU0zi\r
+       wr31bF2MXBxCAvsYJZ6cucsM4WxglHjwezIjhHOfSeL610ksEM58Romlv9vZQfrZBDQktu1f\r
+       zghiiwhIS+y8O5sVZAWzgJrEny4VkLCwgI/EmoOzmUFsFgFVibkzfrOB2LwC9hKdW9eyQ5yh\r
+       IPFs3XGmCYy8CxgZVjHKpuRW6eYmZuYUpybrFicn5uWlFuma6uVmluilppRuYgQHgYvSDsaf\r
+       B5UOMQpwMCrx8B5aP8tfiDWxrLgy9xCjJAeTkihvQfIcfyG+pPyUyozE4oz4otKc1OJDjBIc\r
+       zEoivNriQDnelMTKqtSifJiUNAeLkjivutY7PyGB9MSS1OzU1ILUIpisDAeHkgQvEzDYhQSL\r
+       UtNTK9Iyc0oQ0kwcnCDDeYCG/wNZzFtckJhbnJkOkT/FqCglzisJ0iwAksgozYPrhUXpK0Zx\r
+       oFeEeblAqniAEQ7X/QpoMBPQYCbPWSCDSxIRUlINjH6Hb/Au3eIgqzr5pJNc+ML5G1XbFxl0\r
+       TpkYkLm/rHBVU3ykHqvDd1nfbrlZN14kzLw18VmUYcIuNdfr2xdF+8wrWst8u1L0Qtzu97sF\r
+       vmTVcR6UE3p5L7NmW+jqV3whBdIT1PPNXVP2ZAQezkjceNp00fX+qUmnPNd9nM3V1bMpUGxm\r
+       3o6fDUosxRmJhlrMRcWJAAo+rJ2tAgAA\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 28 Apr 2012 21:45:24 -0000\r
+\r
+The signature of notmuch_database_find_message was changed in 02a30767\r
+to report errors and the Go bindings were never updated.  This brings\r
+the Go bindings in sync with that change and at least makes them\r
+compile with Go r60.3, the last release before Go 1.\r
+---\r
+ bindings/go/pkg/notmuch.go |   13 +++++++------\r
+ 1 files changed, 7 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/bindings/go/pkg/notmuch.go b/bindings/go/pkg/notmuch.go\r
+index c6844ef..8fe400b 100644\r
+--- a/bindings/go/pkg/notmuch.go\r
++++ b/bindings/go/pkg/notmuch.go\r
+@@ -306,20 +306,21 @@ func (self *Database) RemoveMessage(fname string) Status {\r
+  *    * An out-of-memory situation occurs\r
+  *    * A Xapian exception occurs\r
+  */\r
+-func (self *Database) FindMessage(message_id string) *Message {\r
++func (self *Database) FindMessage(message_id string) (*Message, Status) {\r
+       \r
+       var c_msg_id *C.char = C.CString(message_id)\r
+       defer C.free(unsafe.Pointer(c_msg_id))\r
+ \r
+       if c_msg_id == nil {\r
+-              return nil\r
++              return nil, STATUS_OUT_OF_MEMORY\r
+       }\r
+ \r
+-      msg := C.notmuch_database_find_message(self.db, c_msg_id)\r
+-      if msg == nil {\r
+-              return nil\r
++      msg := &Message{message:nil}\r
++      st := Status(C.notmuch_database_find_message(self.db, c_msg_id, &msg.message))\r
++      if st != STATUS_SUCCESS {\r
++              return nil, st\r
+       }\r
+-      return &Message{message:msg}\r
++      return msg, st\r
+ }\r
+ \r
+ /* Return a list of all tags found in the database.\r
+-- \r
+1.7.9.1\r
+\r