sdbox-storage.c revision 7bafda1813454621e03615e83d55bccfa7cc56bd
/* Copyright (c) 2007-2009 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "ioloop.h"
#include "hex-binary.h"
#include "randgen.h"
#include "mkdir-parents.h"
#include "unlink-directory.h"
#include "unlink-old-files.h"
#include "index-mail.h"
#include "mail-index-modseq.h"
#include "mailbox-uidvalidity.h"
#include "dbox-mail.h"
#include "dbox-save.h"
#include "sdbox-file.h"
#include "sdbox-sync.h"
#include "sdbox-storage.h"
#include <stdio.h>
#include <unistd.h>
#define SDBOX_LIST_CONTEXT(obj) \
struct sdbox_mailbox_list {
};
extern struct mail_storage dbox_storage;
extern struct mailbox sdbox_mailbox;
extern struct dbox_storage_vfuncs sdbox_dbox_storage_vfuncs;
static struct mail_storage *sdbox_storage_alloc(void)
{
struct sdbox_storage *storage;
}
struct mailbox *
enum mailbox_flags flags)
{
struct sdbox_mailbox *mbox;
/* dbox can't work without index files */
mbox->hdr_ext_id =
sizeof(struct sdbox_index_header), 0, 0);
}
struct sdbox_index_header *hdr)
{
const void *data;
if (data_size < SDBOX_INDEX_HEADER_MIN_SIZE &&
"dbox %s: Invalid dbox header size",
return -1;
}
return 0;
}
struct mail_index_transaction *trans,
const struct mailbox_update *update)
{
sizeof(new_hdr.mailbox_guid));
}
}
}
const struct mailbox_update *update)
{
struct mail_index_transaction *trans;
const struct mail_index_header *hdr;
else if (hdr->uid_validity == 0) {
/* set uidvalidity */
}
}
}
}
if (mail_index_transaction_commit(&trans) < 0) {
return -1;
}
return 0;
}
const struct mailbox_update *update)
{
const char *origin;
int ret;
/* create indexes immediately with the dbox header */
if (index_storage_mailbox_open(box) < 0)
return -1;
if (ret < 0)
return -1;
}
return -1;
}
return 0;
}
struct mailbox_status *status_r)
{
struct sdbox_index_header hdr;
/* regenerate it */
return;
}
sizeof(status_r->mailbox_guid));
}
static void
struct mailbox_status *status_r)
{
if ((items & STATUS_GUID) != 0)
}
static int
{
if (index_storage_mailbox_open(box) < 0)
return -1;
}
}
static int
{
const char *trash_dest;
int ret;
/* Make sure the indexes are closed before trying to delete the
directory that contains them. It can still fail with some NFS
implementations if indexes are opened by another session, but
that can't really be helped. */
/* delete the index and control directories */
return -1;
return -1;
}
static int
bool rename_children)
{
rename_children) < 0)
return -1;
}
struct mailbox_list *list)
{
struct sdbox_mailbox_list *mlist;
}
struct mail_storage dbox_storage = {
.class_flags = 0,
.v = {
NULL,
NULL,
NULL,
}
};
struct mailbox sdbox_mailbox = {
.v = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
}
};
struct dbox_storage_vfuncs sdbox_dbox_storage_vfuncs = {
};