Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8337:210e2b09d9d4 HEAD
Virtual mailboxes: Don't use virtual mailbox_header_lookup_ctx in backend calls.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 25 Oct 2008 22:51:40 +0300 |
parents | 13418c67c683 |
children | 0ee4090b85fe |
files | src/lib-storage/index/index-mail-headers.c src/plugins/virtual/virtual-mail.c |
diffstat | 2 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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)
--- 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 @@ 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 @@ 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 @@ struct istream **stream_r) { struct virtual_mail *vmail = (struct virtual_mail *)mail; + struct mailbox_header_lookup_ctx *backend_headers; + int ret; - return mail_get_header_stream(vmail->backend_mail, headers, stream_r); + 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