mbox-mail.c revision 838e367716bbd5e44b4a1691db9cbf72af53e9f0
/* Copyright (c) 2003-2008 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "istream.h"
#include "index-mail.h"
#include "mbox-storage.h"
#include "mbox-file.h"
#include "mbox-lock.h"
#include "mbox-sync-private.h"
#include "istream-raw-mbox.h"
#include "istream-header-filter.h"
#include <fcntl.h>
#include <unistd.h>
{
struct mbox_transaction_context *t =
t->mbox_lock_id = 0;
mbox->mbox_lock_id = 0;
}
}
{
struct mbox_transaction_context *t =
enum mbox_sync_flags sync_flags = 0;
bool deleted;
return -1;
return -1;
/* refresh index file after mbox has been locked to
make sure we get only up-to-date mbox offsets. */
return -1;
}
} else if ((sync_flags & MBOX_SYNC_FORCE_SYNC) != 0) {
/* dirty offsets are broken and mbox is write-locked.
sync it to update offsets. */
return -1;
}
if (mbox_file_open_stream(mbox) < 0)
return -1;
if (ret > 0) {
/* success */
break;
}
if (ret < 0) {
if (deleted)
return -1;
}
/* we'll need to re-sync it completely */
}
if (ret == 0) {
"Losing sync for mail uid=%u in mbox file %s",
}
return 0;
}
{
return 0;
if (mbox_mail_seek(mail) < 0)
return -1;
/* it's broken and conflicts with our "not found"
return value. change it. */
data->received_date = 0;
}
return 0;
}
{
return 0;
/* no way to know this. save the current time into cache and use
that from now on. this works only as long as the index files
are permanent */
return 0;
}
static int
const char **value_r)
{
#define EMPTY_MD5_SUM "00000000000000000000000000000000"
switch (field) {
case MAIL_FETCH_FROM_ENVELOPE:
if (mbox_mail_seek(mail) < 0)
return -1;
return 0;
case MAIL_FETCH_HEADER_MD5:
return -1;
return 0;
/* i guess in theory the EMPTY_MD5_SUM is valid and can happen,
but it's almost guaranteed that it means the MD5 sum is
missing. recalculate it. */
return -1;
break;
default:
break;
}
}
{
const struct mail_index_header *hdr;
struct message_size hdr_size;
return 0;
/* we want to return the header size as seen by mail_get_stream(). */
return -1;
/* our header size varies, so don't do any caching */
"Couldn't get mbox size");
return -1;
}
/* use the next message's offset to avoid reading through the entire
message body to find out its size */
/* last message, use the synced mbox size */
int trailer_size;
} else {
}
/* verify that the calculated body size is correct */
return 0;
}
struct message_size *hdr_size,
struct message_size *body_size,
{
struct istream *raw_stream;
if (mbox_mail_seek(mail) < 0)
return -1;
}
}
{
}
{
bool ret;
return ret;
}
struct mail_vfuncs mbox_mail_vfuncs = {
};