mail-namespace.c revision af3f857bb3166ed99595e11a9d18e5b5cc670e1a
/* Copyright (c) 2005-2008 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "file-lock.h"
#include "mail-storage.h"
#include "mail-namespace.h"
#include <stdlib.h>
{
} else {
}
}
{
}
static struct mail_namespace *
enum file_lock_method lock_method,
struct mail_namespace *prev_namespaces)
{
struct mail_namespace *ns;
else
}
else {
return NULL;
}
return NULL;
}
return NULL;
}
}
prefix = "";
if ((flags & MAIL_STORAGE_FLAG_DEBUG) != 0) {
i_info("Namespace: type=%s, prefix=%s, sep=%s, "
"inbox=%s, hidden=%s, list=%s, subscriptions=%s",
list,
"yes" : "no");
}
/* dynamic shared namespace */
driver = "shared";
} else {
}
&error) < 0) {
return NULL;
}
return ns;
}
{
unsigned int private_ns_count = 0;
unsigned int subscriptions_count = 0;
char list_sep = '\0';
i_error("namespace configuration error: "
"There can be only one namespace with "
"inbox=yes");
return FALSE;
}
}
private_ns = ns;
}
i_error("namespace configuration error: "
"list=yes requires prefix=%s "
return FALSE;
}
NAMESPACE_FLAG_LIST_CHILDREN)) != 0) {
if (list_sep == '\0')
i_error("namespace configuration error: "
"All list=yes namespaces must use "
"the same separator");
return FALSE;
}
}
i_error("namespace configuration error: "
"Empty prefix requires list=yes");
return FALSE;
}
}
if (private_ns_count == 1) {
/* just one private namespace. we'll assume it's
the INBOX namespace. */
} else {
i_error("namespace configuration error: "
"inbox=yes namespace missing");
return FALSE;
}
}
if (list_sep == '\0') {
i_error("namespace configuration error: "
"no list=yes namespaces");
return FALSE;
}
if (subscriptions_count == 0) {
i_error("namespace configuration error: "
"no subscriptions=yes namespaces");
return FALSE;
}
return TRUE;
}
{
enum mail_storage_flags flags;
enum file_lock_method lock_method;
unsigned int i;
/* first try NAMESPACE_* environments */
for (i = 1; ; i++) {
T_BEGIN {
} T_END;
break;
T_BEGIN {
} T_END;
return -1;
}
if (namespaces != NULL) {
if (!namespaces_check(namespaces)) {
while (namespaces != NULL) {
ns = namespaces;
}
return -1;
}
if (hook_mail_namespaces_created != NULL) {
T_BEGIN {
} T_END;
}
return 0;
}
/* fallback to MAIL */
/* support also maildir-specific environment */
}
&error) < 0) {
else {
i_error("mail_location not set and "
"autodetection failed: %s", error);
}
return -1;
}
if (hook_mail_namespaces_created != NULL) {
T_BEGIN {
} T_END;
}
return 0;
}
struct mail_namespace *
{
struct mail_namespace *ns;
return ns;
}
{
*_namespaces = NULL;
while (namespaces != NULL) {
ns = namespaces;
}
}
{
struct mail_namespace **nsp;
/* remove from user's namespaces list */
break;
}
}
}
{
char *ret, *p;
return name;
for (p = ret; *p != '\0'; p++) {
}
return ret;
}
const char *name)
{
str_truncate(dest, 0);
else
}
}
{
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;
}