maildir-storage.c revision 7b937fa47f42981b98c98489b19962feb59f098c
/* Copyright (C) 2002 Timo Sirainen */
#include "lib.h"
#include "unlink-directory.h"
#include "subscription-file/subscription-file.h"
#include "maildir-index.h"
#include "maildir-storage.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
extern MailStorage maildir_storage;
static Mailbox maildir_mailbox;
{
/* we'll need to figure out the maildir location ourself.
it's either root dir if we've already chroot()ed, or
data = "/";
else {
}
}
}
return NULL;
return storage;
}
{
}
static int maildir_autodetect(const char *data)
{
}
{
}
/* create or fix maildir, ignore if it already exists */
{
const char **tmp;
char path[1024];
return FALSE;
return FALSE;
}
return TRUE;
}
{
const char **tmp;
/* first make sure the cur/ new/ and tmp/ dirs exist in root dir */
/* create the .INBOX directory */
"%s: %m", dest);
return FALSE;
}
/* then symlink the cur/ new/ and tmp/ into the .INBOX/ directory */
return FALSE;
}
}
return TRUE;
}
int readonly)
{
const char *path;
}
int readonly)
{
char path[1024];
/* INBOX is always case-insensitive */
return NULL;
}
return FALSE;
}
/* exists - make sure the required directories are also there */
name);
return NULL;
} else {
name);
return NULL;
}
}
{
char path[1024];
/* use same case with all INBOX folders or we'll get
into trouble */
}
return FALSE;
}
return TRUE;
return FALSE;
} else {
"%s: %m", name);
return FALSE;
}
}
{
int count;
return FALSE;
}
return FALSE;
}
/* rename the .maildir into ..maildir which marks it as being
deleted. this way we never see partially deleted maildirs. */
name);
return FALSE;
}
count = 0;
"rename(%s, %s) failed: %m",
return FALSE;
}
/* ..dir already existed? delete it and try again */
if (!unlink_directory(dest)) {
"unlink_directory(%s) "
"failed: %m", dest);
return FALSE;
}
count++;
}
if (!unlink_directory(dest)) {
"failed: %m", dest);
return FALSE;
}
return TRUE;
}
{
const char **tmp;
/* newpath points to the destination folder directory, which contains
symlinks to real INBOX directories. unlink() the symlinks and
move the real cur/ directory here. */
"unlink(%s) failed: %m",
newpath);
return FALSE;
}
}
return FALSE;
}
/* create back the cur/ directory for INBOX */
return TRUE;
}
const char *newname)
{
oldname = "INBOX";
return FALSE;
}
/* NOTE: renaming INBOX works just fine with us, it's simply created
the next time it's needed. Only problem with it is that it's not
atomic operation but that can't be really helped. */
return TRUE;
}
"Target mailbox already exists");
return FALSE;
} else {
return FALSE;
}
}
const char *name,
{
char path[1024];
name = "INBOX";
return TRUE;
}
return TRUE;
return TRUE;
} else {
"stat(%s) failed: %m", path);
return FALSE;
}
}
"maildir", /* name */
'.', /* hierarchy_sep - can't be changed */
NULL,
NULL,
};
static Mailbox maildir_mailbox = {
NULL, /* name */
NULL, /* storage */
};