#ifndef MAIL_NAMESPACE_H
#define MAIL_NAMESPACE_H
#include "mail-user.h"
struct mail_storage_callbacks;
enum mail_namespace_type {
#define MAIL_NAMESPACE_TYPE_MASK_ALL \
};
enum namespace_flags {
/* Namespace contains the user's INBOX mailbox. Normally only a single
namespace has this flag set, but when using alias_for for the INBOX
namespace the flag gets copied to the alias namespace as well */
/* Namespace contains someone's INBOX. This is set for both user's
INBOX namespace and also for any other users' shared namespaces. */
/* Namespace is visible only by explicitly using its full prefix */
/* Namespace prefix is visible with LIST */
/* Namespace prefix isn't visible with LIST, but child mailboxes are */
/* Namespace uses its own subscriptions. */
/* Namespace was created automatically (for shared mailboxes) */
/* Namespace has at least some usable mailboxes. Autocreated namespaces
that don't have usable mailboxes may be removed automatically. */
/* Automatically created namespace for a user that doesn't exist. */
/* Don't track quota for this namespace */
/* Don't enforce ACLs for this namespace */
};
struct mail_namespace {
/* Namespaces are sorted by their prefix length, "" comes first */
int refcount;
char *prefix;
/* If non-NULL, this points to a namespace with identical mail location
and it should be considered as the primary way to access the
mailboxes. This allows for example FTS plugin to avoid duplicating
indexes for same mailboxes when they're accessed via different
namespaces. */
/* alias_for->alias_chain_next starts each chain. The chain goes
through all namespaces that have the same alias_for. */
/* This may point to user->set, but it may also point to
namespace-specific settings. When accessing namespace-specific
settings it should be done through here instead of through the
mail_user. */
};
/* Allocate a new namespace, and fill it based on the passed in settings.
This is the most low-level namespace creation function. The storage isn't
initialized for the namespace.
user_all_settings normally points to user->set. If you want to override
settings for the created namespace, you can duplicate the user's settings
and provide a pointer to it here. Note that the pointer must contain
ALL the settings, including the dynamic driver-specific settings, so it
needs to created via settings-parser API. */
void *user_all_settings,
struct mail_namespace_settings *ns_set,
struct mail_namespace_settings *unexpanded_set,
struct mail_namespace **ns_r,
const char **error_r);
/* Add and initialize namespaces to user based on namespace settings. */
/* Add and initialize INBOX namespace to user based on the given location. */
/* Add an empty namespace to user. */
/* Deinitialize all namespaces. mail_user_deinit() calls this automatically
for user's namespaces. */
/* Allocate a new namespace and initialize it. This is called automatically by
mail_namespaces_init(). */
struct mail_namespace_settings *ns_set,
struct mail_namespace_settings *unexpanded_ns_set,
const char **error_r);
/* Set storage callback functions to use in all namespaces. */
struct mail_storage_callbacks *callbacks,
void *context);
/* Add a new storage to namespace. */
struct mail_storage *storage);
/* Destroy a single namespace and remove it from user's namespaces list. */
/* Returns the default storage to use for newly created mailboxes. */
struct mail_storage *
/* Return namespace's hierarchy separator. */
/* Returns the hierarchy separator for mailboxes that are listed at root. */
/* Returns namespace based on the mailbox name's prefix. Note that there is
always a prefix="" namespace, so for this function NULL is never returned. */
struct mail_namespace *
/* Same as mail_namespace_find(), but if the namespace has alias_for set,
return that namespace instead and change mailbox name to be a valid
inside it. */
struct mail_namespace *
const char **mailbox);
/* Like mail_namespace_find(), but ignore hidden namespaces. */
struct mail_namespace *
const char *mailbox);
/* Like mail_namespace_find(), but find only from namespaces with
subscriptions=yes. */
struct mail_namespace *
const char *mailbox);
/* Like mail_namespace_find(), but find only from namespaces with
subscriptions=no. */
struct mail_namespace *
const char *mailbox);
/* Returns the INBOX namespace. It always exists, so NULL is never returned. */
struct mail_namespace *
/* Find a namespace with given prefix. */
struct mail_namespace *
const char *prefix);
/* Like _find_prefix(), but ignore trailing separator */
struct mail_namespace *
const char *prefix);
/* Called internally by mailbox_list_create(). */
struct mailbox_list *list);
/* Returns TRUE if this is the root of a type=shared namespace that is actually
used for accessing shared users' mailboxes (as opposed to marking a
type=public namespace "wrong"). */
/* Returns TRUE if namespace includes INBOX that should be \Noinferiors.
This happens when the namespace has a prefix, which is not empty and not
static inline bool
{
ns->prefix_len > 0 &&
}
#endif