mail-namespace.c revision 925ba01748666a35ed2758abb4d89d48686a95b5
/* Copyright (c) 2005-2009 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "str.h"
#include "file-lock.h"
#include "mail-storage-private.h"
#include "mail-storage-settings.h"
#include "mail-namespace.h"
#include <stdlib.h>
struct mail_storage *storage)
{
/* currently we support only a single storage */
}
struct mailbox_list *list)
{
} else {
}
}
{
}
static int
struct mail_namespace_settings *ns_set,
const struct mail_storage_settings *mail_set,
struct mail_namespace *prev_namespaces,
{
struct mail_namespace *ns;
else {
return -1;
}
return -1;
}
if (ns_set->subscriptions)
return -1;
}
return -1;
}
}
if (mail_set->mail_debug) {
i_info("Namespace: type=%s, prefix=%s, sep=%s, "
"inbox=%s, hidden=%s, list=%s, subscriptions=%s",
}
/* dynamic shared namespace */
driver = "shared";
} else {
}
return -1;
}
return 0;
}
static bool
{
unsigned int subscriptions_count = 0;
char list_sep = '\0';
*error_r = "namespace configuration error: "
"There can be only one namespace with "
"inbox=yes";
return FALSE;
}
}
"namespace configuration error: "
"list=yes requires prefix=%s "
return FALSE;
}
NAMESPACE_FLAG_LIST_CHILDREN)) != 0) {
if (list_sep == '\0')
*error_r = "namespace configuration error: "
"All list=yes namespaces must use "
"the same separator";
return FALSE;
}
}
}
*error_r = "namespace configuration error: "
"inbox=yes namespace missing";
return FALSE;
}
if (list_sep == '\0') {
*error_r = "namespace configuration error: "
"no list=yes namespaces";
return FALSE;
}
if (subscriptions_count == 0) {
*error_r = "namespace configuration error: "
"no subscriptions=yes namespaces";
return FALSE;
}
return TRUE;
}
{
const struct mail_storage_settings *mail_set;
struct mail_namespace_settings *const *ns_set;
struct mail_namespace_settings *inbox_set;
unsigned int i, count;
else {
count = 0;
}
for (i = 0; i < count; i++) {
return -1;
}
if (namespaces != NULL) {
while (namespaces != NULL) {
ns = namespaces;
}
return -1;
}
if (hook_mail_namespaces_created != NULL) {
T_BEGIN {
} T_END;
}
return 0;
}
/* fallback to using environment variables */
env = "MAIL";
/* support also maildir-specific environment */
else {
driver = "maildir";
env = "MAILDIR";
}
}
"Initializing mail storage from environment %s "
} else {
"autodetection failed: %s", error);
}
return -1;
}
if (hook_mail_namespaces_created != NULL) {
T_BEGIN {
} T_END;
}
return 0;
}
{
struct mail_namespace *ns;
return ns;
}
{
*_namespaces = NULL;
while (namespaces != NULL) {
ns = namespaces;
}
}
struct mail_storage_callbacks *callbacks,
void *context)
{
struct mail_namespace *ns;
}
{
struct mail_namespace **nsp;
/* remove from user's namespaces list */
break;
}
}
}
{
char *ret, *p;
return name;
/* shared namespace root. the backend storage's hierarchy
separator isn't known yet, so do nothing. */
return name;
}
for (p = ret; *p != '\0'; p++) {
}
return ret;
}
const char *name)
{
if (len > 0) {
else {
}
}
}
const char *name)
{
str_truncate(dest, 0);
else
}
}
struct mail_storage *
{
/* currently we don't support more than one storage per namespace */
}
{
return namespaces->sep;
}
static struct mail_namespace *
const char **mailbox,
enum namespace_flags flags,
enum namespace_flags mask)
{
bool inbox;
/* find the INBOX namespace */
*mailbox = "INBOX";
return ns;
}
return best;
}
}
}
if (best_len > 0)
}
return best;
}
struct mail_namespace *
{
}
struct mail_namespace *
const char **mailbox)
{
}
struct mail_namespace *
const char **mailbox)
{
}
struct mail_namespace *
const char **mailbox)
{
}
struct mail_namespace *
{
return namespaces;
}
const char **mailbox)
{
/* FIXME: a bit kludgy.. */
}
struct mail_namespace *
const char *prefix)
{
struct mail_namespace *ns;
return ns;
}
return NULL;
}
struct mail_namespace *
const char *prefix)
{
struct mail_namespace *ns;
return ns;
}
return NULL;
}