dbox-storage.c revision 61b0637759146621cbb7edcbd0b03a71cfd66dfe
/* Copyright (c) 2007-2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "mkdir-parents.h"
#include "unlink-old-files.h"
#include "mailbox-uidvalidity.h"
#include "mailbox-list-private.h"
#include "index-storage.h"
#include "dbox-storage.h"
#include <stdio.h>
struct mailbox_list_settings *set)
{
}
{
const char *path;
}
{
else {
}
}
static bool
{
return FALSE;
/* check once in a while if there are temp files to clean up */
/* there haven't been any changes to this directory since we
last checked it. */
/* time to scan */
const char *prefix =
}
return TRUE;
}
const struct mailbox_update *update)
{
const char *origin;
/* create indexes immediately with the dbox header */
return -1;
return -1;
}
return -1;
}
return 0;
}
{
"dbox doesn't support streamed mailboxes");
return -1;
}
/* INBOX always exists, create it */
return -1;
}
return -1;
return -1;
} else {
return -1;
}
}
static const char *
{
const char *root;
unsigned int len;
return NULL;
/* can't determine the alt path - shouldn't happen */
return NULL;
}
}
{
if (directory &&
return 0;
return -1;
return -1;
return 0;
}
const char *mailbox_name ATTR_UNUSED,
enum mailbox_list_file_type type,
enum mailbox_info_flags *flags)
{
const char *path, *maildir_path;
int ret = 1;
/* try to avoid stat() with these checks */
if (type != MAILBOX_LIST_FILE_TYPE_DIR &&
/* it's a file */
return 0;
}
/* need to stat() then */
/* non-directory */
ret = 0;
/* no subdirectories */
*flags |= MAILBOX_NOCHILDREN;
/* default configuration: we have one directory
containing the mailboxes. if there are 3 links,
either this is a selectable mailbox without children
or non-selectable mailbox with children */
*flags |= MAILBOX_CHILDREN;
} else {
/* non-default configuration: all subdirectories are
child mailboxes. */
*flags |= MAILBOX_CHILDREN;
}
/* doesn't exist - probably a non-existing subscribed mailbox */
*flags |= MAILBOX_NONEXISTENT;
} else {
/* non-selectable. probably either access denied, or symlink
destination not found. don't bother logging errors. */
*flags |= MAILBOX_NOSELECT;
}
/* make sure it's a selectable mailbox */
*flags |= MAILBOX_NOSELECT;
/* now we know what link count 3 means. */
if ((*flags & MAILBOX_NOSELECT) != 0)
*flags |= MAILBOX_CHILDREN;
else
*flags |= MAILBOX_NOCHILDREN;
}
}
return ret;
}
static int
const char *oldname,
struct mailbox_list *newlist,
const char *newname,
{
const char *path;
return 0;
/* destination dbox storage doesn't have alt-path defined.
we can't do the rename easily. */
"Can't rename mailboxes across specified storages.");
return -1;
}
return 1;
}
const char *oldname,
struct mailbox_list *newlist,
const char *newname)
{
const char *alt_oldpath, *alt_newpath;
int ret;
&alt_oldpath, &alt_newpath);
if (ret <= 0)
return ret;
/* race condition or a directory left there lying around?
safest to just report error. */
"Target mailbox already exists");
return -1;
return -1;
}
return 0;
}
bool rename_children)
{
int ret;
&alt_newpath);
if (ret <= 0)
return ret;
/* ok */
if (!rename_children) {
"rmdir(%s) failed: %m", path);
}
}
/* renaming is done already, so just log the error */
}
return 0;
}