mail-namespace.c revision b56f7fb35a314aa8b179f97ae0a085ad321a7594
/* Copyright (c) 2005-2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "str.h"
#include "file-lock.h"
#include "settings-parser.h"
#include "mailbox-list-private.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)
{
}
{
}
static int
struct mail_namespace_settings *ns_set,
struct mail_namespace_settings *unexpanded_ns_set,
const struct mail_storage_settings *mail_set,
{
struct mail_namespace *ns;
else {
return -1;
}
return -1;
}
}
if (ns_set->subscriptions)
if (mail_set->mail_debug) {
i_debug("Namespace %s: type=%s, prefix=%s, sep=%s, "
"inbox=%s, hidden=%s, list=%s, subscriptions=%s "
"location=%s",
}
/* dynamic shared namespace. the above check catches wrong
mixed %% usage, but still allows for specifying a shared
namespace to an explicit location without any %% */
driver = "shared";
} else {
}
return -1;
}
return 0;
}
const char **error_r)
{
"Namespace %s can't have alias_for=%s "
"to a different storage type (%s vs %s)",
return FALSE;
}
"Namespace %s can't have alias_for=%s "
"to a different storage (different root dirs)",
return FALSE;
}
return TRUE;
}
static int
struct mail_namespace *all_namespaces,
const char **error_r)
{
return -1;
}
return -1;
}
return -1;
}
return 0;
}
static bool
{
unsigned int subscriptions_count = 0;
"Duplicate namespace prefix: \"%s\"",
return FALSE;
}
return FALSE;
*error_r = "There can be only one namespace with "
"inbox=yes";
return FALSE;
}
}
NAMESPACE_FLAG_LIST_CHILDREN)) != 0 &&
"list=yes requires prefix=%s "
return FALSE;
}
NAMESPACE_FLAG_LIST_CHILDREN)) != 0 &&
"list=yes requires prefix=%s "
return FALSE;
}
NAMESPACE_FLAG_LIST_CHILDREN)) != 0) {
if (list_sep == '\0')
*error_r = "All list=yes namespaces must use "
"the same separator";
return FALSE;
}
}
}
*error_r = "inbox=yes namespace missing";
return FALSE;
}
if (list_sep == '\0') {
*error_r = "no list=yes namespaces";
return FALSE;
}
if (subscriptions_count == 0) {
*error_r = "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 *const *unexpanded_ns_set;
} else {
count = 0;
}
for (i = 0; i < count; i++) {
if (!ns_set[i]->ignore_on_failure)
return -1;
if (mail_set->mail_debug) {
i_debug("Skipping namespace %s: %s",
}
} else {
}
}
if (namespaces != NULL) {
while (namespaces != NULL) {
ns = namespaces;
}
return -1;
}
T_BEGIN {
} T_END;
return 0;
}
/* no namespaces defined, create a default one */
}
const char **error_r)
{
struct mail_namespace *ns;
const struct mail_storage_settings *mail_set;
location_source = "mail_location parameter";
/* don't actually set it to namespace, since we'll default to
it anyway */
location_source = "mail_location setting";
} else {
location_source = "environment MAIL";
}
/* support also maildir-specific environment */
else {
driver = "maildir";
location_source = "environment MAILDIR";
}
}
} else {
}
"Initializing mail storage from %s "
} else {
"autodetection failed: %s", error);
}
return -1;
}
T_BEGIN {
} T_END;
return 0;
}
{
struct mail_namespace *ns;
return ns;
}
{
/* update *_namespaces as needed, instead of immediately setting it
to NULL. for example mdbox_storage.destroy() wants to go through
user's namespaces. */
while (*_namespaces != NULL) {
ns = *_namespaces;
*_namespaces = next;
}
}
struct mail_storage_callbacks *callbacks,
void *context)
{
struct mail_namespace *ns;
}
{
}
{
return;
}
{
struct mail_namespace **nsp;
/* remove from user's namespaces list */
break;
}
}
}
struct mail_storage *
{
/* currently we don't support more than one storage per namespace */
}
{
}
{
return mail_namespace_get_sep(namespaces);
}
{
/* true exact prefix match */
return TRUE;
}
/* we already checked that mailbox begins with case-insensitive
INBOX. this namespace also begins with INBOX and the rest
of the prefix matches too. */
return TRUE;
}
/* we're trying to access the namespace prefix itself */
return TRUE;
}
return FALSE;
}
static struct mail_namespace *
enum namespace_flags flags,
enum namespace_flags mask)
{
unsigned int best_len = 0;
bool inbox;
/* find the INBOX namespace */
return ns;
}
return best;
}
}
}
return best;
}
static struct mail_namespace *
{
struct mail_storage *storage;
return ns;
return mailbox_list_get_namespace(list);
}
struct mail_namespace *
{
struct mail_namespace *ns;
/* see if we need to autocreate a namespace for shared user */
}
return ns;
}
struct mail_namespace *
const char **mailbox)
{
struct mail_namespace *ns;
const char *storage_name;
}
return ns;
}
struct mail_namespace *
const char *mailbox)
{
}
struct mail_namespace *
const char *mailbox)
{
}
struct mail_namespace *
const char *mailbox)
{
}
struct mail_namespace *
{
return namespaces;
}
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;
}