mbox-mail.c revision 8000c86be02008b74acc71fa422444dc432e2c01
bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (C) 2003-2006 Timo Sirainen */
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
08d6658a4e2ec8104cd1307f6baa75fdb07a24f8Mark Washenberger#include "lib.h"
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen#include "ioloop.h"
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen#include "istream.h"
bdd36cfdba3ff66d25570a9ff568d69e1eb543cfTimo Sirainen#include "index-mail.h"
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen#include "mbox-storage.h"
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen#include "mbox-file.h"
be5c76fabc7439fd33bc799bc3ab3f570799977bTimo Sirainen#include "mbox-lock.h"
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen#include "mbox-sync-private.h"
b0e9375a1ff97c9c7d40655922af5ccc73ecaa76Timo Sirainen#include "istream-raw-mbox.h"
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen#include "istream-header-filter.h"
d176f84ce5ca2073f4dfbafb457b9c74f6bf0d76Timo Sirainen
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen#include <fcntl.h>
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen#include <unistd.h>
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen#include <sys/stat.h>
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
c0757c70cfd2c9b44de3504b753a4d2f38690ef0Timo Sirainenstatic void mbox_prepare_resync(struct index_mail *mail)
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen{
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen struct mbox_transaction_context *t =
b624773984e35dd894db8dff976c1a2114c70782Timo Sirainen (struct mbox_transaction_context *)mail->trans;
5afc76d0215c5f7631dec06ef864d59f0686a0a8Timo Sirainen struct mbox_mailbox *mbox = (struct mbox_mailbox *)mail->ibox;
b624773984e35dd894db8dff976c1a2114c70782Timo Sirainen
12d38e76ba7f70d6219c89ec7416fea0d5de7e02Timo Sirainen if (mbox->mbox_lock_type == F_RDLCK) {
b624773984e35dd894db8dff976c1a2114c70782Timo Sirainen if (mbox->mbox_lock_id == t->mbox_lock_id)
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen t->mbox_lock_id = 0;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen (void)mbox_unlock(mbox, mbox->mbox_lock_id);
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen mbox->mbox_lock_id = 0;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen i_assert(mbox->mbox_lock_type == F_UNLCK);
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen }
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen}
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainenstatic int mbox_mail_seek(struct index_mail *mail)
3a7113e3e2dac0e333e1a3f62af7d682896f59c6Timo Sirainen{
c0757c70cfd2c9b44de3504b753a4d2f38690ef0Timo Sirainen struct mbox_transaction_context *t =
be5c76fabc7439fd33bc799bc3ab3f570799977bTimo Sirainen (struct mbox_transaction_context *)mail->trans;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen struct mbox_mailbox *mbox = (struct mbox_mailbox *)mail->ibox;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen enum mbox_sync_flags sync_flags = 0;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen int ret;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen bool deleted;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen if (mail->mail.mail.expunged)
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen return 0;
e9371f899a3d4207a0ffd3923ea5ec7250cf5e75Timo Sirainen
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen__again:
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen if (mbox->mbox_lock_type == F_UNLCK) {
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen sync_flags |= MBOX_SYNC_LOCK_READING;
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen if (mbox_sync(mbox, sync_flags) < 0)
788a0754cfd38dcfec1902844b085e4e84cfe7e6Timo Sirainen return -1;
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen
788a0754cfd38dcfec1902844b085e4e84cfe7e6Timo Sirainen /* refresh index file after mbox has been locked to make
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen sure we get only up-to-date mbox offsets. */
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen if (mail_index_refresh(mbox->ibox.index) < 0) {
43d3ea2780b5f8557ede7b4c039e8f56cb8d357dTimo Sirainen mail_storage_set_index_error(&mbox->ibox);
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen return -1;
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen }
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen i_assert(mbox->mbox_lock_type != F_UNLCK);
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen t->mbox_lock_id = mbox->mbox_lock_id;
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen } else if ((sync_flags & MBOX_SYNC_FORCE_SYNC) != 0) {
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen /* dirty offsets are broken and mbox is write-locked.
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen sync it to update offsets. */
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen if (mbox_sync(mbox, sync_flags) < 0)
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen return -1;
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen }
f93c833d644ecff0b0f80bee4f1cdde3e697b5c8Timo Sirainen
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen if (mbox_file_open_stream(mbox) < 0)
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen return -1;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen ret = mbox_file_seek(mbox, mail->trans->trans_view,
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen mail->mail.mail.seq, &deleted);
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen if (ret < 0) {
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen if (deleted) {
5f1d689131a75c39f064cbd4202373e7edf78f18Josef 'Jeff' Sipek mail->mail.mail.expunged = TRUE;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen return 0;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen }
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen return -1;
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi }
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen if (ret == 0) {
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen /* we'll need to re-sync it completely */
31597236d79ac38a5cea7ab65a9d0a3df64ed201Timo Sirainen mbox_prepare_resync(mail);
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen sync_flags |= MBOX_SYNC_UNDIRTY | MBOX_SYNC_FORCE_SYNC;
9ed2951bd0bb1878a27437d7c00611b2baadd614Timo Sirainen goto __again;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen }
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen return 1;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen}
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
31597236d79ac38a5cea7ab65a9d0a3df64ed201Timo Sirainenstatic time_t mbox_mail_get_received_date(struct mail *_mail)
31597236d79ac38a5cea7ab65a9d0a3df64ed201Timo Sirainen{
83d2e37f065eabe38dc92db485c5ca39ee43ce05Timo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
026d971be5201aed5ccf60138900770e42cf0de5Timo Sirainen struct index_mail_data *data = &mail->data;
83d2e37f065eabe38dc92db485c5ca39ee43ce05Timo Sirainen struct mbox_mailbox *mbox = (struct mbox_mailbox *)mail->ibox;
31597236d79ac38a5cea7ab65a9d0a3df64ed201Timo Sirainen uint32_t t;
7569ab8537418b7fc369265f26595b0ef9e4cb35Timo Sirainen
7569ab8537418b7fc369265f26595b0ef9e4cb35Timo Sirainen (void)index_mail_get_received_date(_mail);
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen if (data->received_date != (time_t)-1)
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi return data->received_date;
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi if (mbox_mail_seek(mail) <= 0)
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi return (time_t)-1;
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi data->received_date =
e0a84bcd487b05872da59781452168609b5c1f2cTimo Sirainen istream_raw_mbox_get_received_time(mbox->mbox_stream);
e0a84bcd487b05872da59781452168609b5c1f2cTimo Sirainen if (data->received_date == (time_t)-1) {
e0a84bcd487b05872da59781452168609b5c1f2cTimo Sirainen /* it's broken and conflicts with our "not found"
e0a84bcd487b05872da59781452168609b5c1f2cTimo Sirainen return value. change it. */
e0a84bcd487b05872da59781452168609b5c1f2cTimo Sirainen data->received_date = 0;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen }
9ed2951bd0bb1878a27437d7c00611b2baadd614Timo Sirainen
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi t = data->received_date;
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi index_mail_cache_add(mail, MAIL_CACHE_RECEIVED_DATE, &t, sizeof(t));
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi return data->received_date;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen}
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
798cfe56c9871262770384da1239162b3800cce1Timo Sirainenstatic time_t mbox_mail_get_save_date(struct mail *_mail)
c0757c70cfd2c9b44de3504b753a4d2f38690ef0Timo Sirainen{
798cfe56c9871262770384da1239162b3800cce1Timo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
798cfe56c9871262770384da1239162b3800cce1Timo Sirainen struct index_mail_data *data = &mail->data;
c0757c70cfd2c9b44de3504b753a4d2f38690ef0Timo Sirainen
d6bffcdf187c155dccc04fb4267b4f82ce59347dTimo Sirainen (void)index_mail_get_save_date(_mail);
c0757c70cfd2c9b44de3504b753a4d2f38690ef0Timo Sirainen if (data->save_date != (time_t)-1)
3a7113e3e2dac0e333e1a3f62af7d682896f59c6Timo Sirainen return data->save_date;
e2a88d59c0d47d63ce1ad5b1fd95e487124a3fd4Timo Sirainen
e2a88d59c0d47d63ce1ad5b1fd95e487124a3fd4Timo Sirainen /* no way to know this. save the current time into cache and use
d1ba8ecbb936ace90179d2292952546708d68f71Timo Sirainen that from now on. this works only as long as the index files
c0757c70cfd2c9b44de3504b753a4d2f38690ef0Timo Sirainen are permanent */
4b1781e4c64be52e25b5994e5242dbe696cc7d29Timo Sirainen data->save_date = ioloop_time;
4b1781e4c64be52e25b5994e5242dbe696cc7d29Timo Sirainen index_mail_cache_add(mail, MAIL_CACHE_SAVE_DATE,
d6bffcdf187c155dccc04fb4267b4f82ce59347dTimo Sirainen &data->save_date, sizeof(data->save_date));
c0757c70cfd2c9b44de3504b753a4d2f38690ef0Timo Sirainen return data->save_date;
d6bffcdf187c155dccc04fb4267b4f82ce59347dTimo Sirainen}
d6bffcdf187c155dccc04fb4267b4f82ce59347dTimo Sirainen
c0757c70cfd2c9b44de3504b753a4d2f38690ef0Timo Sirainenstatic const char *
798cfe56c9871262770384da1239162b3800cce1Timo Sirainenmbox_mail_get_special(struct mail *_mail, enum mail_fetch_field field)
798cfe56c9871262770384da1239162b3800cce1Timo Sirainen{
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen#define EMPTY_MD5_SUM "00000000000000000000000000000000"
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen struct mbox_mailbox *mbox = (struct mbox_mailbox *)mail->ibox;
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen const char *value;
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen
e0a84bcd487b05872da59781452168609b5c1f2cTimo Sirainen switch (field) {
e0a84bcd487b05872da59781452168609b5c1f2cTimo Sirainen case MAIL_FETCH_FROM_ENVELOPE:
e0a84bcd487b05872da59781452168609b5c1f2cTimo Sirainen if (mbox_mail_seek(mail) <= 0)
e0a84bcd487b05872da59781452168609b5c1f2cTimo Sirainen return NULL;
e0a84bcd487b05872da59781452168609b5c1f2cTimo Sirainen
e0a84bcd487b05872da59781452168609b5c1f2cTimo Sirainen return istream_raw_mbox_get_sender(mbox->mbox_stream);
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen case MAIL_FETCH_HEADER_MD5:
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen value = index_mail_get_special(_mail, field);
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen if (value != NULL && strcmp(value, EMPTY_MD5_SUM) != 0)
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen return value;
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen /* i guess in theory the EMPTY_MD5_SUM is valid and can happen,
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen but it's almost guaranteed that it means the MD5 sum is
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen missing. recalculate it. */
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen mbox->mbox_save_md5 = TRUE;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen mbox_prepare_resync(mail);
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen if (mbox_sync(mbox, MBOX_SYNC_FORCE_SYNC) < 0)
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen return NULL;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen break;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen default:
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen break;
31633d676642b83305b8d46da495d9bb4e2d1ff8Timo Sirainen }
47bb4a7615c85f212f061499f04f121d6d625387Timo Sirainen
47bb4a7615c85f212f061499f04f121d6d625387Timo Sirainen return index_mail_get_special(_mail, field);
b0e9375a1ff97c9c7d40655922af5ccc73ecaa76Timo Sirainen}
b0e9375a1ff97c9c7d40655922af5ccc73ecaa76Timo Sirainen
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainenstatic uoff_t mbox_mail_get_physical_size(struct mail *_mail)
226259ee6fb9830dafc1a5ba1e95bf5a4345b406Timo Sirainen{
6e5a4cdf7ef123589e2409e0012b1024c97957d5Aki Tuomi struct index_mail *mail = (struct index_mail *)_mail;
6e5a4cdf7ef123589e2409e0012b1024c97957d5Aki Tuomi struct index_mail_data *data = &mail->data;
6e5a4cdf7ef123589e2409e0012b1024c97957d5Aki Tuomi struct mbox_mailbox *mbox = (struct mbox_mailbox *)mail->ibox;
6e5a4cdf7ef123589e2409e0012b1024c97957d5Aki Tuomi struct istream *stream;
b0e9375a1ff97c9c7d40655922af5ccc73ecaa76Timo Sirainen uoff_t hdr_offset, body_offset, body_size;
b0e9375a1ff97c9c7d40655922af5ccc73ecaa76Timo Sirainen
226259ee6fb9830dafc1a5ba1e95bf5a4345b406Timo Sirainen if (mbox_mail_seek(mail) <= 0)
b0e9375a1ff97c9c7d40655922af5ccc73ecaa76Timo Sirainen return (uoff_t)-1;
865a82c1e9bba11609835a36674964649025bf77Timo Sirainen
865a82c1e9bba11609835a36674964649025bf77Timo Sirainen /* our header size varies, so don't do any caching */
b0e9375a1ff97c9c7d40655922af5ccc73ecaa76Timo Sirainen stream = mbox->mbox_stream;
b0e9375a1ff97c9c7d40655922af5ccc73ecaa76Timo Sirainen hdr_offset = istream_raw_mbox_get_header_offset(stream);
b0e9375a1ff97c9c7d40655922af5ccc73ecaa76Timo Sirainen body_offset = istream_raw_mbox_get_body_offset(stream);
a138ac12134564b151f00fdef86fba9cd9ba8af0Timo Sirainen if (body_offset == (uoff_t)-1)
5d4855d7b4dcffb6975ed8e3c9c376dac74e5c8aTimo Sirainen return (uoff_t)-1;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen body_size = istream_raw_mbox_get_body_size(stream, (uoff_t)-1);
c0757c70cfd2c9b44de3504b753a4d2f38690ef0Timo Sirainen
82f53ea81671bcc7b9bf24a34b04a4ba2752efd3Timo Sirainen data->physical_size = (body_offset - hdr_offset) + body_size;
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainen return data->physical_size;
82f53ea81671bcc7b9bf24a34b04a4ba2752efd3Timo Sirainen
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainen}
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainenstatic struct istream *mbox_mail_get_stream(struct mail *_mail,
ce6b6093957885a74fd6e85c18801dbb727d61ecTimo Sirainen struct message_size *hdr_size,
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen struct message_size *body_size)
31597236d79ac38a5cea7ab65a9d0a3df64ed201Timo Sirainen{
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen struct index_mail *mail = (struct index_mail *)_mail;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen struct index_mail_data *data = &mail->data;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen struct mbox_mailbox *mbox = (struct mbox_mailbox *)mail->ibox;
adc409a7ac9689d3baf811712ad5a5432cab2d87Timo Sirainen struct istream *raw_stream;
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen uoff_t offset;
8eb94c5190ba09bb6f6f068eec7bf96750f08d1dTimo Sirainen
e9503210d3521a6833ed62dc332fc42ffb0e7a13Timo Sirainen if (data->stream == NULL) {
31597236d79ac38a5cea7ab65a9d0a3df64ed201Timo Sirainen if (mbox_mail_seek(mail) <= 0)
9261dbf0675204898c6557591c7aa376e23a52b2Timo Sirainen return NULL;
e9503210d3521a6833ed62dc332fc42ffb0e7a13Timo Sirainen
ce6b6093957885a74fd6e85c18801dbb727d61ecTimo Sirainen raw_stream = mbox->mbox_stream;
e9503210d3521a6833ed62dc332fc42ffb0e7a13Timo Sirainen offset = istream_raw_mbox_get_header_offset(raw_stream);
31597236d79ac38a5cea7ab65a9d0a3df64ed201Timo Sirainen raw_stream = i_stream_create_limit(default_pool, raw_stream,
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen offset, (uoff_t)-1);
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi data->stream =
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi i_stream_create_header_filter(raw_stream,
ce6b6093957885a74fd6e85c18801dbb727d61ecTimo Sirainen HEADER_FILTER_EXCLUDE,
70c181da837ed85fc5b0426c010b65609bda5329Timo Sirainen mbox_hide_headers,
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi mbox_hide_headers_count,
50168536f8d04626d71860c73b2efc18d407d083Aki Tuomi NULL, NULL);
70c181da837ed85fc5b0426c010b65609bda5329Timo Sirainen i_stream_unref(&raw_stream);
adc409a7ac9689d3baf811712ad5a5432cab2d87Timo Sirainen }
3cf67672fdc87583cb23ce088c95bb5dee60e74dTimo Sirainen
adc409a7ac9689d3baf811712ad5a5432cab2d87Timo Sirainen return index_mail_init_stream(mail, hdr_size, body_size);
adc409a7ac9689d3baf811712ad5a5432cab2d87Timo Sirainen}
adc409a7ac9689d3baf811712ad5a5432cab2d87Timo Sirainen
adc409a7ac9689d3baf811712ad5a5432cab2d87Timo Sirainenstruct mail_vfuncs mbox_mail_vfuncs = {
9ed2951bd0bb1878a27437d7c00611b2baadd614Timo Sirainen index_mail_free,
3cf67672fdc87583cb23ce088c95bb5dee60e74dTimo Sirainen index_mail_set_seq,
adc409a7ac9689d3baf811712ad5a5432cab2d87Timo Sirainen index_mail_set_uid,
adc409a7ac9689d3baf811712ad5a5432cab2d87Timo Sirainen
adc409a7ac9689d3baf811712ad5a5432cab2d87Timo Sirainen index_mail_get_flags,
8eb94c5190ba09bb6f6f068eec7bf96750f08d1dTimo Sirainen index_mail_get_keywords,
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainen index_mail_get_parts,
ce6b6093957885a74fd6e85c18801dbb727d61ecTimo Sirainen index_mail_get_date,
e9503210d3521a6833ed62dc332fc42ffb0e7a13Timo Sirainen mbox_mail_get_received_date,
e9503210d3521a6833ed62dc332fc42ffb0e7a13Timo Sirainen mbox_mail_get_save_date,
e9503210d3521a6833ed62dc332fc42ffb0e7a13Timo Sirainen index_mail_get_virtual_size,
adc409a7ac9689d3baf811712ad5a5432cab2d87Timo Sirainen mbox_mail_get_physical_size,
adc409a7ac9689d3baf811712ad5a5432cab2d87Timo Sirainen index_mail_get_first_header,
b321df9603081896b70ec44635af96d674a9839aTimo Sirainen index_mail_get_headers,
ce6b6093957885a74fd6e85c18801dbb727d61ecTimo Sirainen index_mail_get_header_stream,
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen mbox_mail_get_stream,
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen mbox_mail_get_special,
f968e62caa52a8924bd05ebf76ff515b5c18e17bTimo Sirainen index_mail_update_flags,
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen index_mail_update_keywords,
b44650b0f48a4b5f0dc240ed836833a00b643b9fTimo Sirainen index_mail_expunge
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen};
2e29e4797a48d78d669821722bdb54fd0a1d3b94Timo Sirainen