[RFC PATCH 06/13] Pass mailstore to _notmuch_message_index_file
authorEthan Glasser-Camp <glasse@cs.rpi.edu>
Wed, 15 Feb 2012 22:01:59 +0000 (17:01 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:34 +0000 (09:44 -0800)
a5/597e474f4e8ca1673a3011b1f5a2827ac426d8 [new file with mode: 0644]

diff --git a/a5/597e474f4e8ca1673a3011b1f5a2827ac426d8 b/a5/597e474f4e8ca1673a3011b1f5a2827ac426d8
new file mode 100644 (file)
index 0000000..f4119b2
--- /dev/null
@@ -0,0 +1,142 @@
+Return-Path: <glasse@cs.rpi.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 BC12F429E43\r
+       for <notmuch@notmuchmail.org>; Wed, 15 Feb 2012 14:09:03 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.54\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.54 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       RCVD_IN_BL_SPAMCOP_NET=1.246, RCVD_IN_DNSWL_MED=-2.3,\r
+       RCVD_IN_SORBS_WEB=0.614] 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 zTEYsFfCblKZ for <notmuch@notmuchmail.org>;\r
+       Wed, 15 Feb 2012 14:09:00 -0800 (PST)\r
+Received: from cliffclavin.cs.rpi.edu (cliffclavin.cs.rpi.edu\r
+ [128.113.126.25])     (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)       by olra.theworths.org (Postfix) with ESMTPS\r
+ id 18D69431E62        for <notmuch@notmuchmail.org>; Wed, 15 Feb 2012 14:09:00 -0800\r
+ (PST)\r
+X-Hash:\r
+ S|aae69e273e498d5de66d9e3bf68ac0c0606b5478|d4c21c0d0b80a5462346b7b26b45ba37\r
+X-Countries: Cameroon, United States\r
+X-SMTP-From: accepted <glasse@cs.rpi.edu> [195.24.209.20] [195.24.209.20]\r
+       (localhost) {Cameroon}\r
+DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=cs.rpi.edu; h=from\r
+       :to:cc:subject:date:message-id:in-reply-to:references; s=\r
+       default; i=glasse@cs.rpi.edu; t=1329343738; x=1329948538; l=2068;\r
+       bh=0k/K3RQun05tWxgXhC3iFXolbX4=; b=myzeyUcltgZD6sw3FXw8s8j\r
+       DWkQwAll8BNvVzPp5Tkpgn3hkUoxWV1b/U+sDm8ei2FpD/KyYz2VugaZJmED3lZk\r
+       F8XBtv1HMACSDhfJma6URSSgBmPbMDjkNQXJz0OvI2TEZAax//afm0m9LbSiefo1\r
+       0+dsYU3VF98FQhyeg6Gg=\r
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=cs.rpi.edu; h=from:to:cc\r
+       :subject:date:message-id:in-reply-to:references; q=dns; s=\r
+       default; b=nVT88z7gJqsDfxH/kAE1glE5gD9mn3G7+QcOqNh3KdYZ0/i4upbbQ\r
+       ZFCBdDtoppRpE4wtv46ZY0DOv9TPJdXlVMChrPidmwCWqiqhslBkdIT93x+Zos3L\r
+       Jvub5o88Uvv/62EikywOSrXNGGos1JhEiDPKm8iERtQrs+99yATEzg=\r
+X-Spam-Info: -2.7; ALL_TRUSTED,AWL,BAYES_00\r
+X-Spam-Scanned-By: cliffclavin.cs.rpi.edu using SpamAssassin 3.2.5 (hard limit\r
+       15)\r
+Authentication-Results: cliffclavin.cs.rpi.edu;\r
+       DKIM=neutral (none) header.from=glasse@cs.rpi.edu;\r
+       SPF=neutral (mfrom;\r
+       Mechanism '?all' matched) smtp.mail=glasse@cs.rpi.edu\r
+X-Auth-Passed: cliffclavin.cs.rpi.edu:q1FM8PIt008817 Auth:glasse\r
+X-Virus-Scanned-By: cliffclavin.cs.rpi.edu\r
+Received: from localhost ([195.24.209.20]) (authenticated bits=0)\r
+       by cliffclavin.cs.rpi.edu (8.14.3/8.14.3) with ESMTP id q1FM8PIt008817\r
+       (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO);\r
+       Wed, 15 Feb 2012 17:08:44 -0500 (EST)\r
+       (envelope-from glasse@cs.rpi.edu)\r
+From: Ethan Glasser-Camp <glasse@cs.rpi.edu>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH 06/13] Pass mailstore to _notmuch_message_index_file\r
+Date: Wed, 15 Feb 2012 17:01:59 -0500\r
+Message-Id: <1329343326-16410-7-git-send-email-glasse@cs.rpi.edu>\r
+X-Mailer: git-send-email 1.7.5.4\r
+In-Reply-To: <1329343326-16410-1-git-send-email-glasse@cs.rpi.edu>\r
+References: <1329343326-16410-1-git-send-email-glasse@cs.rpi.edu>\r
+X-Scanned-By: MIMEDefang 2.67 on 128.113.126.25\r
+Cc: Ethan Glasser-Camp <ethan@betacantrips.com>\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: Wed, 15 Feb 2012 22:09:03 -0000\r
+\r
+From: Ethan Glasser-Camp <ethan@betacantrips.com>\r
+\r
+This is the last place where fopen(2) was used and had to be replaced.\r
+\r
+Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>\r
+---\r
+ lib/database.cc       |    2 +-\r
+ lib/index.cc          |    5 +++--\r
+ lib/notmuch-private.h |    3 ++-\r
+ 3 files changed, 6 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index ff44e76..0ed4412 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -1743,7 +1743,7 @@ notmuch_database_add_message (notmuch_database_t *notmuch,\r
+           date = notmuch_message_file_get_header (message_file, "date");\r
+           _notmuch_message_set_header_values (message, date, from, subject);\r
\r
+-          _notmuch_message_index_file (message, filename);\r
++          _notmuch_message_index_file (notmuch->mailstore, message, filename);\r
+       } else {\r
+           ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;\r
+       }\r
+diff --git a/lib/index.cc b/lib/index.cc\r
+index d8f8b2b..54b8f73 100644\r
+--- a/lib/index.cc\r
++++ b/lib/index.cc\r
+@@ -409,7 +409,8 @@ _index_mime_part (notmuch_message_t *message,\r
+ }\r
\r
+ notmuch_status_t\r
+-_notmuch_message_index_file (notmuch_message_t *message,\r
++_notmuch_message_index_file (notmuch_mailstore_t *mailstore,\r
++                           notmuch_message_t *message,\r
+                            const char *filename)\r
+ {\r
+     GMimeStream *stream = NULL;\r
+@@ -426,7 +427,7 @@ _notmuch_message_index_file (notmuch_message_t *message,\r
+       initialized = 1;\r
+     }\r
\r
+-    file = fopen (filename, "r");\r
++    file = notmuch_mailstore_open (mailstore, filename);\r
+     if (! file) {\r
+       fprintf (stderr, "Error opening %s: %s\n", filename, strerror (errno));\r
+       ret = NOTMUCH_STATUS_FILE_ERROR;\r
+diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h\r
+index 2589928..d93891e 100644\r
+--- a/lib/notmuch-private.h\r
++++ b/lib/notmuch-private.h\r
+@@ -313,7 +313,8 @@ notmuch_message_get_author (notmuch_message_t *message);\r
+ /* index.cc */\r
\r
+ notmuch_status_t\r
+-_notmuch_message_index_file (notmuch_message_t *message,\r
++_notmuch_message_index_file (notmuch_mailstore_t *mailstore,\r
++                           notmuch_message_t *message,\r
+                            const char *filename);\r
\r
+ /* message-file.c */\r
+-- \r
+1.7.5.4\r
+\r