dovecot-1.2: Virtual mailboxes: Don't use virtual mailbox_header...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Oct 25 22:51:44 EEST 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/210e2b09d9d4
changeset: 8337:210e2b09d9d4
user: Timo Sirainen <tss at iki.fi>
date: Sat Oct 25 22:51:40 2008 +0300
description:
Virtual mailboxes: Don't use virtual mailbox_header_lookup_ctx in backend calls.
diffstat:
2 files changed, 18 insertions(+), 3 deletions(-)
src/lib-storage/index/index-mail-headers.c | 2 ++
src/plugins/virtual/virtual-mail.c | 19 ++++++++++++++++---
diffs (57 lines):
diff -r 13418c67c683 -r 210e2b09d9d4 src/lib-storage/index/index-mail-headers.c
--- a/src/lib-storage/index/index-mail-headers.c Sat Oct 25 22:50:43 2008 +0300
+++ b/src/lib-storage/index/index-mail-headers.c Sat Oct 25 22:51:40 2008 +0300
@@ -730,6 +730,8 @@ int index_mail_get_header_stream(struct
struct istream *input;
string_t *dest;
+ i_assert(_headers->box == _mail->box);
+
if (mail->data.save_bodystructure_header) {
/* we have to parse the header. */
if (index_mail_parse_headers(mail, _headers) < 0)
diff -r 13418c67c683 -r 210e2b09d9d4 src/plugins/virtual/virtual-mail.c
--- a/src/plugins/virtual/virtual-mail.c Sat Oct 25 22:50:43 2008 +0300
+++ b/src/plugins/virtual/virtual-mail.c Sat Oct 25 22:51:40 2008 +0300
@@ -81,6 +81,7 @@ static void virtual_mail_set_seq(struct
struct virtual_mailbox *mbox = (struct virtual_mailbox *)mail->box;
struct virtual_backend_box *bbox;
struct mailbox_transaction_context *backend_trans;
+ struct mailbox_header_lookup_ctx *backend_headers;
const struct virtual_mail_index_record *vrec;
const struct mail_index_record *rec;
const void *data;
@@ -95,9 +96,15 @@ static void virtual_mail_set_seq(struct
if (vmail->backend_mail == NULL) {
backend_trans =
virtual_transaction_get(mail->transaction, bbox->box);
+
+ backend_headers = vmail->wanted_headers == NULL ? NULL :
+ mailbox_header_lookup_init(bbox->box,
+ vmail->wanted_headers->headers);
vmail->backend_mail = mail_alloc(backend_trans,
vmail->wanted_fields,
- vmail->wanted_headers);
+ backend_headers);
+ if (backend_headers != NULL)
+ mailbox_header_lookup_unref(&backend_headers);
array_append(&vmail->backend_mails, &vmail->backend_mail, 1);
}
mail_set_uid(vmail->backend_mail, vrec->real_uid);
@@ -205,8 +212,14 @@ virtual_mail_get_header_stream(struct ma
struct istream **stream_r)
{
struct virtual_mail *vmail = (struct virtual_mail *)mail;
-
- return mail_get_header_stream(vmail->backend_mail, headers, stream_r);
+ struct mailbox_header_lookup_ctx *backend_headers;
+ int ret;
+
+ backend_headers = mailbox_header_lookup_init(vmail->backend_mail->box,
+ headers->headers);
+ ret = mail_get_header_stream(vmail->backend_mail, headers, stream_r);
+ mailbox_header_lookup_unref(&backend_headers);
+ return ret;
}
static int
More information about the dovecot-cvs
mailing list