mail-namespace.c revision a3f6d0302a83270253ff9d2ebd4fea0003e9ac95
/* Copyright (c) 2005-2007 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 *ns;
else {
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",
"yes" : "no");
}
&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;
}
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;
}
static struct mail_namespace *
{
break;
}
}
return dest;
}
struct mail_namespace **namespaces_r)
{
enum mail_storage_flags flags;
enum file_lock_method lock_method;
unsigned int i;
/* first try NAMESPACE_* environments */
for (i = 1; ; i++) {
);
break;
);
return -1;
}
if (namespaces != NULL) {
if (!namespaces_check(namespaces))
return -1;
if (hook_mail_namespaces_created != NULL) {
);
}
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;
}
*namespaces_r = ns;
if (hook_mail_namespaces_created != NULL) {
);
}
return 0;
}
{
struct mail_namespace *ns;
return ns;
}
{
*_namespaces = NULL;
while (namespaces != NULL) {
}
}
{
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 *
{
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;
}