mailbox-list-maildir.c revision 5160580b0ec3f3288a320987abdf12a990f09df5
/* Copyright (C) 2006-2007 Timo Sirainen */
#include "lib.h"
#include "array.h"
#include "hostpid.h"
#include "home-expand.h"
#include "subscription-file.h"
#include "mailbox-list-maildir.h"
#include <stdio.h>
extern struct mailbox_list maildir_mailbox_list;
static struct mailbox_list *maildir_list_alloc(void)
{
struct maildir_mailbox_list *list;
list->temp_prefix =
}
{
struct maildir_mailbox_list *list =
(struct maildir_mailbox_list *)_list;
}
static const char *
{
const char *p;
if (home_try_expand(&name) < 0) {
/* fallback to using as ~name */
return name;
}
if (p == NULL)
return name;
}
static bool
{
/* check that there are no adjacent hierarchy separators */
return FALSE;
}
return FALSE;
return FALSE;
return TRUE;
}
static bool maildir_list_is_valid_common_nonfs(const char *name)
{
return FALSE;
/* "." and ".." aren't allowed. */
return FALSE;
}
return TRUE;
}
static bool __attr_noreturn__
const char *mask __attr_unused__)
{
i_unreached();
#ifndef __attrs_used__
return FALSE;
#endif
}
static bool
{
return FALSE;
return TRUE;
return maildir_list_is_valid_common_nonfs(name);
}
static bool
{
return FALSE;
return FALSE;
return TRUE;
return FALSE;
return FALSE;
return TRUE;
}
static const char *
enum mailbox_list_path_type type)
{
struct maildir_mailbox_list *list =
(struct maildir_mailbox_list *)_list;
/* return root directories */
switch (type) {
}
i_unreached();
}
switch (type) {
break;
return t_strdup_printf("%s/%c%s",
}
break;
return "";
}
break;
}
}
}
static int
const char *name,
enum mailbox_name_status *status)
{
const char *path;
return 0;
}
return 0;
}
return 0;
} else {
return -1;
}
}
static const char *
{
struct maildir_mailbox_list *list =
(struct maildir_mailbox_list *)_list;
return list->temp_prefix;
}
{
struct maildir_mailbox_list *list =
(struct maildir_mailbox_list *)_list;
const char *path;
}
enum mailbox_list_path_type type,
{
return 0;
return -1;
}
return 0;
}
{
struct mailbox_list_iterate_context *iter;
struct mailbox_info *info;
ARRAY_DEFINE(names_arr, const char *);
const char *const *names;
unsigned int i, count;
int ret;
ret = 0;
/* first get the list of the children and save them to memory, because
we can't rely on readdir() not skipping files while the directory
is being modified. this doesn't protect against modifications by
other processes though. */
const char *name;
}
if (mailbox_list_iter_deinit(&iter) < 0) {
ret = -1;
} else {
}
for (i = 0; i < count; i++) {
t_push();
/* FIXME: it's possible to merge two mailboxes if either one of
them doesn't have existing root mailbox. We could check this
but I'm not sure if it's worth it. It could be even
considered as a feature.
Anyway, the bug with merging is that if both mailboxes have
identically named child mailbox they conflict. Just ignore
those and leave them under the old mailbox. */
ret = 1;
else {
ret = -1;
t_pop();
break;
}
t_pop();
}
return ret;
}
static int
{
/* let the backend handle the rest */
}
{
int ret;
bool found;
/* NOTE: it's possible to rename a nonexisting mailbox which has
children. In that case we should ignore the rename() error. */
if (ret < 0)
return -1;
return -1;
}
return 0;
}
if (EDESTDIREXISTS(errno)) {
} else {
}
return -1;
}
struct mailbox_list maildir_mailbox_list = {
{
NULL,
NULL,
}
};