mbox-mail.c revision fe6c1556d3529a6376d4cbb3766c34aebde0de99
/* Copyright (C) 2003-2006 Timo Sirainen */
#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 0;
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 0;
}
return -1;
}
/* we'll need to re-sync it completely */
}
if (ret == 0) {
"Losing sync for mail uid=%u in mbox file %s",
}
return 1;
}
{
uint32_t t;
(void)index_mail_get_received_date(_mail);
return data->received_date;
if (mbox_mail_seek(mail) <= 0)
return (time_t)-1;
/* it's broken and conflicts with our "not found"
return value. change it. */
data->received_date = 0;
}
t = data->received_date;
return data->received_date;
}
{
(void)index_mail_get_save_date(_mail);
/* 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 */
}
static const char *
{
#define EMPTY_MD5_SUM "00000000000000000000000000000000"
const char *value;
switch (field) {
case MAIL_FETCH_FROM_ENVELOPE:
if (mbox_mail_seek(mail) <= 0)
return NULL;
case MAIL_FETCH_HEADER_MD5:
return value;
/* 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 NULL;
break;
default:
break;
}
}
{
if (mbox_mail_seek(mail) <= 0)
return (uoff_t)-1;
/* our header size varies, so don't do any caching */
return (uoff_t)-1;
return data->physical_size;
}
struct message_size *hdr_size,
struct message_size *body_size)
{
struct istream *raw_stream;
if (mbox_mail_seek(mail) <= 0)
return NULL;
}
}
struct mail_vfuncs mbox_mail_vfuncs = {
};