1 Return-Path: <glasse@cs.rpi.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 9365D429E4B
\r
6 for <notmuch@notmuchmail.org>; Wed, 15 Feb 2012 14:07:19 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.54 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 RCVD_IN_BL_SPAMCOP_NET=1.246, RCVD_IN_DNSWL_MED=-2.3,
\r
14 RCVD_IN_SORBS_WEB=0.614] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id NWHKeYUZ6Q6p for <notmuch@notmuchmail.org>;
\r
18 Wed, 15 Feb 2012 14:07:18 -0800 (PST)
\r
19 Received: from cliffclavin.cs.rpi.edu (cliffclavin.cs.rpi.edu
\r
20 [128.113.126.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
21 (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS
\r
22 id BFDFC429E43 for <notmuch@notmuchmail.org>; Wed, 15 Feb 2012 14:07:18 -0800
\r
25 S|c9a46fb05653beb036aa8a2f5cd53e86bc2366ab|0f4b2c36d102b5f2ffc0459f38eddc6a
\r
26 X-Countries: Cameroon, United States
\r
27 X-SMTP-From: accepted <glasse@cs.rpi.edu> [195.24.209.20] [195.24.209.20]
\r
28 (localhost) {Cameroon}
\r
29 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=cs.rpi.edu; h=from
\r
30 :to:cc:subject:date:message-id:in-reply-to:references; s=
\r
31 default; i=glasse@cs.rpi.edu; t=1329343636; x=1329948436; l=4548;
\r
32 bh=C6KSzMhe4sgXd3I7P9T/rblWgTo=; b=It70KlpQEXVTE65up8/mCga
\r
33 uG39FCTr/Ehq2SgYXaHagpP0lp9fkwbj39u35CsE7b9GsSJySRmQqygFmQpwBAp0
\r
34 u1LAM8+PrCYit9qBZAPRPDQ8xAEQGR7Lxejr4N01+jYACwCu9+ctl1x/hwbPrici
\r
35 QIr9XCBabtU6fwuZBfOc=
\r
36 DomainKey-Signature: a=rsa-sha1; c=nofws; d=cs.rpi.edu; h=from:to:cc
\r
37 :subject:date:message-id:in-reply-to:references; q=dns; s=
\r
38 default; b=eJ97MEUSmYXSNvCUxoJs5sFIn66dAE+Oz/4Mxuax+q1nev3bO7XPw
\r
39 O5FuzMNP050gBok+teM/oo5eQ2SjERFOivwTRqwQ2Fw62bo9pgJUlrdsLVD6MyFn
\r
40 lTLn15utPUongCsvo6FnVjDKxQfmRDTcZXCQtKgaR+VaPFnJWs3Bjs=
\r
41 X-Spam-Info: -2.7; ALL_TRUSTED,AWL,BAYES_00
\r
42 X-Spam-Scanned-By: cliffclavin.cs.rpi.edu using SpamAssassin 3.2.5 (hard limit
\r
44 Authentication-Results: cliffclavin.cs.rpi.edu;
\r
45 DKIM=neutral (none) header.from=glasse@cs.rpi.edu;
\r
47 Mechanism '?all' matched) smtp.mail=glasse@cs.rpi.edu
\r
48 X-Auth-Passed: cliffclavin.cs.rpi.edu:q1FM6Acr008772 Auth:glasse
\r
49 X-Virus-Scanned-By: cliffclavin.cs.rpi.edu
\r
50 Received: from localhost ([195.24.209.20]) (authenticated bits=0)
\r
51 by cliffclavin.cs.rpi.edu (8.14.3/8.14.3) with ESMTP id q1FM6Acr008772
\r
52 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO);
\r
53 Wed, 15 Feb 2012 17:06:56 -0500 (EST)
\r
54 (envelope-from glasse@cs.rpi.edu)
\r
55 From: Ethan Glasser-Camp <glasse@cs.rpi.edu>
\r
56 To: notmuch@notmuchmail.org
\r
57 Subject: [RFC PATCH 04/13] Replace remaining places where fopen occurs
\r
58 Date: Wed, 15 Feb 2012 17:01:57 -0500
\r
59 Message-Id: <1329343326-16410-5-git-send-email-glasse@cs.rpi.edu>
\r
60 X-Mailer: git-send-email 1.7.5.4
\r
61 In-Reply-To: <1329343326-16410-1-git-send-email-glasse@cs.rpi.edu>
\r
62 References: <1329343326-16410-1-git-send-email-glasse@cs.rpi.edu>
\r
63 X-Scanned-By: MIMEDefang 2.67 on 128.113.126.25
\r
64 Cc: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
65 X-BeenThere: notmuch@notmuchmail.org
\r
66 X-Mailman-Version: 2.1.13
\r
68 List-Id: "Use and development of the notmuch mail system."
\r
69 <notmuch.notmuchmail.org>
\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
73 List-Post: <mailto:notmuch@notmuchmail.org>
\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
76 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
77 X-List-Received-Date: Wed, 15 Feb 2012 22:07:19 -0000
\r
79 From: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
81 Because mail might no longer be on disk, other uses of fopen(2) need
\r
82 to be replaced with calls to notmuch_mailstore_open. This isn't all of
\r
83 them, but these are the ones that involve touching the API in a lot of
\r
86 This commit updates mime_node_open, show_message_body, and a couple
\r
87 random calls in the commands notmuch show, notmuch reply,
\r
89 Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>
\r
92 notmuch-client.h | 2 ++
\r
93 notmuch-reply.c | 2 +-
\r
94 notmuch-show.c | 9 +++++----
\r
95 show-message.c | 3 ++-
\r
96 5 files changed, 12 insertions(+), 7 deletions(-)
\r
98 diff --git a/mime-node.c b/mime-node.c
\r
99 index d6b4506..856fc3b 100644
\r
102 @@ -61,6 +61,7 @@ _mime_node_context_free (mime_node_context_t *res)
\r
105 mime_node_open (const void *ctx, notmuch_message_t *message,
\r
106 + notmuch_mailstore_t *mailstore,
\r
107 #ifdef GMIME_ATLEAST_26
\r
108 GMimeCryptoContext *cryptoctx,
\r
110 @@ -89,7 +90,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
\r
112 talloc_set_destructor (mctx, _mime_node_context_free);
\r
114 - mctx->file = fopen (filename, "r");
\r
115 + mctx->file = notmuch_mailstore_open (mailstore, filename);
\r
116 if (! mctx->file) {
\r
117 fprintf (stderr, "Error opening %s: %s\n", filename, strerror (errno));
\r
118 status = NOTMUCH_STATUS_FILE_ERROR;
\r
119 diff --git a/notmuch-client.h b/notmuch-client.h
\r
120 index c1c30a2..405aad7 100644
\r
121 --- a/notmuch-client.h
\r
122 +++ b/notmuch-client.h
\r
123 @@ -188,6 +188,7 @@ query_string_from_args (void *ctx, int argc, char *argv[]);
\r
126 show_message_body (notmuch_message_t *message,
\r
127 + notmuch_mailstore_t *mailstore,
\r
128 const notmuch_show_format_t *format,
\r
129 notmuch_show_params_t *params);
\r
131 @@ -372,6 +373,7 @@ typedef struct mime_node {
\r
134 mime_node_open (const void *ctx, notmuch_message_t *message,
\r
135 + notmuch_mailstore_t *mailstore,
\r
136 #ifdef GMIME_ATLEAST_26
\r
137 GMimeCryptoContext *cryptoctx,
\r
139 diff --git a/notmuch-reply.c b/notmuch-reply.c
\r
140 index cb1dd6e..523e2d0 100644
\r
141 --- a/notmuch-reply.c
\r
142 +++ b/notmuch-reply.c
\r
143 @@ -587,7 +587,7 @@ notmuch_reply_format_default(void *ctx,
\r
144 notmuch_message_get_header (mailstore, message, "date"),
\r
145 notmuch_message_get_header (mailstore, message, "from"));
\r
147 - show_message_body (message, format, params);
\r
148 + show_message_body (message, mailstore, format, params);
\r
150 notmuch_message_destroy (message);
\r
152 diff --git a/notmuch-show.c b/notmuch-show.c
\r
153 index 81d4cf0..0d2a246 100644
\r
154 --- a/notmuch-show.c
\r
155 +++ b/notmuch-show.c
\r
156 @@ -285,7 +285,7 @@ format_message_mbox (const void *ctx,
\r
159 filename = notmuch_message_get_filename (message);
\r
160 - file = fopen (filename, "r");
\r
161 + file = notmuch_mailstore_open (mailstore, filename);
\r
162 if (file == NULL) {
\r
163 fprintf (stderr, "Failed to open %s: %s\n",
\r
164 filename, strerror (errno));
\r
165 @@ -830,7 +830,8 @@ show_message (void *ctx,
\r
166 void *local = talloc_new (ctx);
\r
167 mime_node_t *root, *part;
\r
169 - if (mime_node_open (local, message, params->cryptoctx, params->decrypt,
\r
170 + if (mime_node_open (local, message, mailstore,
\r
171 + params->cryptoctx, params->decrypt,
\r
172 &root) == NOTMUCH_STATUS_SUCCESS &&
\r
173 (part = mime_node_seek_dfs (root, (params->part < 0 ?
\r
174 0 : params->part))))
\r
175 @@ -853,7 +854,7 @@ show_message (void *ctx,
\r
178 if (format->part_content)
\r
179 - show_message_body (message, format, params);
\r
180 + show_message_body (message, mailstore, format, params);
\r
182 if (params->part <= 0) {
\r
183 fputs (format->body_end, stdout);
\r
184 @@ -955,7 +956,7 @@ do_show_single (void *ctx,
\r
188 - file = fopen (filename, "r");
\r
189 + file = notmuch_mailstore_open (mailstore, filename);
\r
190 if (file == NULL) {
\r
191 fprintf (stderr, "Error: Cannot open file %s: %s\n", filename, strerror (errno));
\r
193 diff --git a/show-message.c b/show-message.c
\r
194 index 83ecf81..aed9d3e 100644
\r
195 --- a/show-message.c
\r
196 +++ b/show-message.c
\r
197 @@ -80,6 +80,7 @@ show_message_part (mime_node_t *node,
\r
200 show_message_body (notmuch_message_t *message,
\r
201 + notmuch_mailstore_t *mailstore,
\r
202 const notmuch_show_format_t *format,
\r
203 notmuch_show_params_t *params)
\r
205 @@ -87,7 +88,7 @@ show_message_body (notmuch_message_t *message,
\r
206 show_message_state_t state;
\r
207 mime_node_t *root, *part;
\r
209 - ret = mime_node_open (NULL, message, params->cryptoctx, params->decrypt,
\r
210 + ret = mime_node_open (NULL, message, mailstore, params->cryptoctx, params->decrypt,
\r