dbox-storage.c revision f7539a17ea306191b53b8f5e752e228937df9ec3
/* Copyright (C) 2005-2007 Timo Sirainen */
#include "lib.h"
#include "array.h"
#include "ioloop.h"
#include "mkdir-parents.h"
#include "unlink-directory.h"
#include "index-mail.h"
#include "mail-copy.h"
#include "dbox-uidlist.h"
#include "dbox-sync.h"
#include "dbox-file.h"
#include "dbox-storage.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
/* How often to touch the uidlist lock file when using KEEP_LOCKED flag */
#define DBOX_LIST_CONTEXT(obj) \
const struct dotlock_settings default_uidlist_dotlock_set = {
};
const struct dotlock_settings default_file_dotlock_set = {
};
static const struct dotlock_settings default_new_file_dotlock_set = {
};
extern struct mail_storage dbox_storage;
extern struct mailbox dbox_mailbox;
static int
enum mailbox_list_file_type type,
enum mailbox_info_flags *flags);
static bool
{
const char *p;
return FALSE;
/* Don't allow the mailbox name to end in dbox-Mails */
if (p != NULL)
name = p + 1;
}
static bool
{
const char *const *tmp;
return FALSE;
/* Don't allow creating mailboxes under dbox-Mails */
t_push();
break;
}
}
t_pop();
return ret;
}
static int
{
const char *p;
/* we won't do any guessing for this format. */
if (debug)
i_info("dbox: mailbox location not given");
return -1;
}
/* <root dir> [:INDEX=<dir>] */
if (debug)
if (p == NULL)
else {
do {
p++;
p = strchr(p, ':');
} while (p != NULL);
}
/* strip trailing '/' */
return 0;
}
static struct mail_storage *dbox_alloc(void)
{
struct dbox_storage *storage;
}
static int
{
struct mailbox_list_settings list_set;
struct mailbox_list *list;
const char *error;
return -1;
if ((flags & MAIL_STORAGE_FLAG_NO_AUTOCREATE) != 0) {
i_error("stat(%s) failed: %m",
}
return -1;
}
}
return -1;
}
return -1;
}
if ((flags & MAIL_STORAGE_FLAG_DOTLOCK_USE_EXCL) != 0) {
}
return 0;
}
{
}
{
const char *path;
if (debug)
return FALSE;
}
if (debug)
return FALSE;
}
return TRUE;
}
{
const char *error;
if (mail_storage_errno2str(&error)) {
return -1;
}
path);
return -1;
}
return 0;
}
{
return 0;
return -1;
}
return 0;
}
{
return FALSE;
}
{
}
static struct mailbox *
enum mailbox_open_flags flags)
{
struct dbox_mailbox *mbox;
struct mail_index *index;
return NULL;
return NULL;
else
else
else
if ((flags & MAILBOX_OPEN_KEEP_LOCKED) != 0) {
mailbox_close(&box);
return NULL;
}
mbox);
}
}
static struct mailbox *
{
const char *path;
"dbox doesn't support streamed mailboxes");
return NULL;
}
return NULL;
}
return NULL;
} else {
path);
return NULL;
}
}
const char *name,
bool directory __attr_unused__)
{
const char *path;
return -1;
}
return -1;
}
}
static int
{
/* make sure the indexes are closed before trying to delete the
directory that contains them */
/* delete the index and control directories */
return -1;
/* doesn't exist at all */
return -1;
}
/* exists as a \NoSelect mailbox */
return 0;
"Directory %s isn't empty, can't delete it.",
name));
} else {
"rmdir() failed for %s: %m", path);
}
return -1;
}
if (mail_storage_errno2str(&error))
else {
"unlink_directory() failed for %s: %m",
}
return -1;
}
/* try also removing the root directory. it can fail if the deleted
mailbox had submailboxes. do it as long as we can. */
if (p == NULL)
break;
}
return 0;
}
{
}
return 0;
}
static void
{
return;
}
}
enum mailbox_list_file_type type,
enum mailbox_info_flags *flags)
{
const char *mail_path;
int ret = 1;
return 0;
}
/* try to avoid stat() with these checks */
if (type != MAILBOX_LIST_FILE_TYPE_DIR &&
/* it's a file */
return 0;
}
/* need to stat() then */
t_push();
/* non-directory */
ret = 0;
}
} else {
/* non-selectable, but may contain subdirs */
*flags |= MAILBOX_CHILDREN;
*flags |= MAILBOX_NOSELECT;
}
t_pop();
return ret;
}
static void dbox_class_init(void)
{
}
static void dbox_class_deinit(void)
{
}
struct mail_storage dbox_storage = {
{
}
};
struct mailbox dbox_mailbox = {
{
}
};