mailbox-list.h revision 458752f9e9012482843b92379bcfebecfe26f360
2e37d45867d081db150ab78dad303b9077aea24fTimo Sirainen#ifndef MAILBOX_LIST_H
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen#define MAILBOX_LIST_H
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen#include "guid.h"
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen#include "mail-error.h"
b1f37113a5760bee842c5a7678bb5fa6f5bd8b60Timo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen#ifdef PATH_MAX
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen# define MAILBOX_LIST_NAME_MAX_LENGTH PATH_MAX
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen#else
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen# define MAILBOX_LIST_NAME_MAX_LENGTH 4096
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen#endif
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainenenum namespace_type;
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainenstruct mail_namespace;
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainenstruct mail_storage;
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainenstruct mailbox_list;
71df09024cea5f2faa93da3bb9513ee96ba6bf22Timo Sirainenstruct mailbox_list_iterate_context;
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainenenum mailbox_list_properties {
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* maildir_name must always be empty */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_PROP_NO_MAILDIR_NAME = 0x01,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* alt directories not supported */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_PROP_NO_ALT_DIR = 0x02,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* no support for \noselect directories, only mailboxes */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_PROP_NO_NOSELECT = 0x04,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* mail root directory isn't required */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_PROP_NO_ROOT = 0x08,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Automatically create mailbox directories when needed */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_PROP_AUTOCREATE_DIRS = 0x10
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen};
70ac869db925653b57f721cd045c467612fd5ee9Timo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainenenum mailbox_list_flags {
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Mailboxes are files, not directories. */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_FLAG_MAILBOX_FILES = 0x01,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Namespace already has a mailbox list, don't assign this
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen mailbox list to it. */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_FLAG_SECONDARY = 0x02
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen};
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainenenum mailbox_info_flags {
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_NOSELECT = 0x001,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_NONEXISTENT = 0x002,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_CHILDREN = 0x004,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_NOCHILDREN = 0x008,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_NOINFERIORS = 0x010,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_MARKED = 0x020,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_UNMARKED = 0x040,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_SUBSCRIBED = 0x080,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_CHILD_SUBSCRIBED = 0x100,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Internally used by lib-storage */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_SELECT = 0x20000000,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_MATCHED = 0x40000000
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen};
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainenenum mailbox_list_iter_flags {
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Ignore index file and ACLs (used by ACL plugin internally) */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_ITER_RAW_LIST = 0x000001,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* When listing "foo/%" and "foo" is an existing mailbox
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen (maybe \noselect), have LIST also return "foo/" in the replies.
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen This is needed by IMAP, but messes up internal code. */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_ITER_SHOW_EXISTING_PARENT = 0x000002,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Don't list autocreated mailboxes (e.g. INBOX) unless they
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen physically exist */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_ITER_NO_AUTO_BOXES = 0x000004,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* For mailbox_list_iter_init_namespaces(): Skip namespaces that
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen have alias_for set. */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_ITER_SKIP_ALIASES = 0x000008,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* For mailbox_list_iter_init_namespaces(): '*' in a pattern doesn't
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen match beyond namespace boundary (e.g. "foo*" or "*o" doesn't match
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen "foo." namespace's mailboxes, but "*.*" does). also '%' can't match
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen namespace prefixes, if there exists a parent namespace whose children
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen it matches. */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_ITER_STAR_WITHIN_NS = 0x000010,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* List only subscribed mailboxes */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_ITER_SELECT_SUBSCRIBED = 0x000100,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Return MAILBOX_CHILD_* if mailbox's children match selection
b1f37113a5760bee842c5a7678bb5fa6f5bd8b60Timo Sirainen criteria, even if the mailbox itself wouldn't match. */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_ITER_SELECT_RECURSIVEMATCH = 0x000200,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Return only mailboxes that have special use flags */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_ITER_SELECT_SPECIALUSE = 0x000400,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Don't return any flags unless it can be done without cost */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_ITER_RETURN_NO_FLAGS = 0x001000,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Return MAILBOX_SUBSCRIBED flag */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_ITER_RETURN_SUBSCRIBED = 0x002000,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Return children flags */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_ITER_RETURN_CHILDREN = 0x004000,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Return IMAP special use flags */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_ITER_RETURN_SPECIALUSE = 0x008000
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen};
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainenenum mailbox_list_path_type {
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Return directory's path (eg. ~/dbox/INBOX) */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_PATH_TYPE_DIR,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_PATH_TYPE_ALT_DIR,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Return mailbox path (eg. ~/dbox/INBOX/dbox-Mails) */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_PATH_TYPE_MAILBOX,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Return control directory */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_PATH_TYPE_CONTROL,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Return index file directory */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_PATH_TYPE_INDEX
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen};
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainenenum mailbox_list_file_type {
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_FILE_TYPE_UNKNOWN = 0,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_FILE_TYPE_FILE,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_FILE_TYPE_DIR,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_FILE_TYPE_SYMLINK,
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen MAILBOX_LIST_FILE_TYPE_OTHER
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen};
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainenstruct mailbox_list_settings {
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen const char *layout; /* FIXME: shouldn't be here */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen const char *root_dir;
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen const char *index_dir;
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen const char *control_dir;
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen const char *alt_dir; /* FIXME: dbox-specific.. */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen const char *inbox_path;
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen const char *subscription_fname;
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* If non-empty, it means that mails exist in a maildir_name
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen subdirectory. eg. if you have a directory containing directories:
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen mail/
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen mail/foo/
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen mail/foo/Maildir
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen If mailbox_name is empty, you have mailboxes "mail", "mail/foo" and
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen "mail/foo/Maildir".
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen If mailbox_name is "Maildir", you have a non-selectable mailbox
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen "mail" and a selectable mailbox "mail/foo". */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen const char *maildir_name;
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* if set, store mailboxes under root_dir/mailbox_dir_name/.
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen this setting contains either "" or "dir/". */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen const char *mailbox_dir_name;
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen /* Encode "bad" characters in mailbox names as <escape_char><hex> */
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen char escape_char;
/* Use UTF-8 mailbox names on filesystem instead of mUTF-7 */
bool utf8;
};
struct mailbox_info {
const char *name;
const char *special_use;
enum mailbox_info_flags flags;
struct mail_namespace *ns;
};
struct mailbox_permissions {
/* The actual uid/gid of the mailbox */
uid_t file_uid;
gid_t file_gid;
/* mode and GID to use for newly created files/dirs.
(gid_t)-1 is used if the default GID can be used. */
mode_t file_create_mode, dir_create_mode;
gid_t file_create_gid;
/* origin (e.g. path) where the file_create_gid was got from */
const char *file_create_gid_origin;
bool mail_index_permissions_set;
};
/* register all drivers */
void mailbox_list_register_all(void);
void mailbox_list_register(const struct mailbox_list *list);
void mailbox_list_unregister(const struct mailbox_list *list);
const struct mailbox_list *
mailbox_list_find_class(const char *driver);
/* Returns 0 if ok, -1 if driver was unknown. */
int mailbox_list_create(const char *driver, struct mail_namespace *ns,
const struct mailbox_list_settings *set,
enum mailbox_list_flags flags,
struct mailbox_list **list_r, const char **error_r);
void mailbox_list_destroy(struct mailbox_list **list);
const char *
mailbox_list_get_driver_name(const struct mailbox_list *list) ATTR_PURE;
enum mailbox_list_flags
mailbox_list_get_flags(const struct mailbox_list *list) ATTR_PURE;
struct mail_namespace *
mailbox_list_get_namespace(const struct mailbox_list *list) ATTR_PURE;
struct mail_user *
mailbox_list_get_user(const struct mailbox_list *list) ATTR_PURE;
int mailbox_list_get_storage(struct mailbox_list **list, const char *vname,
struct mail_storage **storage_r);
void mailbox_list_get_closest_storage(struct mailbox_list *list,
struct mail_storage **storage);
char mailbox_list_get_hierarchy_sep(struct mailbox_list *list);
/* Returns the mode and GID that should be used when creating new files and
directories to the specified mailbox. (gid_t)-1 is returned if it's not
necessary to change the default gid. */
void mailbox_list_get_permissions(struct mailbox_list *list, const char *name,
struct mailbox_permissions *permissions_r);
/* Like mailbox_list_get_permissions(), but for creating files/dirs to the
mail root directory (or even the root dir itself). */
void mailbox_list_get_root_permissions(struct mailbox_list *list,
mode_t *file_mode_r, mode_t *dir_mode_r,
gid_t *gid_r, const char **gid_origin_r);
/* Create path's directory with proper permissions. */
int mailbox_list_mkdir(struct mailbox_list *list,
const char *mailbox, const char *path);
/* Like mailbox_list_mkdir(), but create path's parent parent directory.
Since most directories are created lazily, this function can be used to
easily create them whenever file creation fails with ENOENT. */
int mailbox_list_mkdir_parent(struct mailbox_list *list,
const char *mailbox, const char *path);
/* mkdir() a root directory of given type with proper permissions. */
int mailbox_list_mkdir_root(struct mailbox_list *list, const char *path,
enum mailbox_list_path_type type,
const char **error_r);
/* Returns TRUE if the name doesn't contain any invalid characters.
The create name check can be more strict. */
bool mailbox_list_is_valid_pattern(struct mailbox_list *list,
const char *pattern);
bool mailbox_list_is_valid_existing_name(struct mailbox_list *list,
const char *name);
bool mailbox_list_is_valid_create_name(struct mailbox_list *list,
const char *name);
const char *mailbox_list_get_storage_name(struct mailbox_list *list,
const char *vname);
const char *mailbox_list_get_vname(struct mailbox_list *list, const char *name);
/* Return full path for the given mailbox name. The name must be a valid
existing mailbox name, or NULL to get the root directory.
For INDEX=MEMORY it returns "" as the path. */
const char *mailbox_list_get_path(struct mailbox_list *list, const char *name,
enum mailbox_list_path_type type);
/* Returns mailbox's change log, or NULL if it doesn't have one. */
struct mailbox_log *mailbox_list_get_changelog(struct mailbox_list *list);
/* Specify timestamp to use when writing mailbox changes to changelog.
The same timestamp is used until stamp is set to (time_t)-1, after which
current time is used */
void mailbox_list_set_changelog_timestamp(struct mailbox_list *list,
time_t stamp);
/* Returns a prefix that temporary files should use without conflicting
with the namespace. */
const char *mailbox_list_get_temp_prefix(struct mailbox_list *list);
/* Returns prefix that's common to all get_temp_prefix() calls.
Typically this returns either "temp." or ".temp.". */
const char *mailbox_list_get_global_temp_prefix(struct mailbox_list *list);
/* Returns a single pattern from given reference and pattern. */
const char *mailbox_list_join_refpattern(struct mailbox_list *list,
const char *ref, const char *pattern);
/* Initialize new mailbox list request. Pattern may contain '%' and '*'
wildcards as defined by RFC-3501. */
struct mailbox_list_iterate_context *
mailbox_list_iter_init(struct mailbox_list *list, const char *pattern,
enum mailbox_list_iter_flags flags);
/* Like mailbox_list_iter_init(), but support multiple patterns. Patterns is
a NULL-terminated list of strings. It must contain at least one pattern. */
struct mailbox_list_iterate_context *
mailbox_list_iter_init_multiple(struct mailbox_list *list,
const char *const *patterns,
enum mailbox_list_iter_flags flags);
/* List mailbox_list_iter_init_multiple(), but list mailboxes from all the
specified namespaces. */
struct mailbox_list_iterate_context *
mailbox_list_iter_init_namespaces(struct mail_namespace *namespaces,
const char *const *patterns,
enum namespace_type type_mask,
enum mailbox_list_iter_flags flags);
/* Get next mailbox. Returns the mailbox name */
const struct mailbox_info *
mailbox_list_iter_next(struct mailbox_list_iterate_context *ctx);
/* Deinitialize mailbox list request. Returns -1 if some error
occurred while listing. */
int mailbox_list_iter_deinit(struct mailbox_list_iterate_context **ctx);
/* List one mailbox. Returns 1 if info returned, 0 if mailbox doesn't exist,
-1 if error. */
int mailbox_list_mailbox(struct mailbox_list *list, const char *name,
enum mailbox_info_flags *flags_r);
/* Returns 1 if mailbox has children, 0 if not, -1 if error. */
int mailbox_has_children(struct mailbox_list *list, const char *name);
/* Subscribe/unsubscribe mailbox. There should be no error when
subscribing to already subscribed mailbox. Subscribing to
unexisting mailboxes is optional. */
int mailbox_list_set_subscribed(struct mailbox_list *list,
const char *name, bool set);
/* Create a non-selectable mailbox. Fail with MAIL_ERROR_NOTPOSSIBLE if only
a selectable mailbox can be created. */
int mailbox_list_create_dir(struct mailbox_list *list, const char *name);
/* Delete a non-selectable mailbox. Fail if the mailbox is selectable. */
int mailbox_list_delete_dir(struct mailbox_list *list, const char *name);
/* Delete a symlinked mailbox. Fail if the mailbox isn't a symlink. */
int mailbox_list_delete_symlink(struct mailbox_list *list, const char *name);
/* Returns the error message of last occurred error. */
const char *mailbox_list_get_last_error(struct mailbox_list *list,
enum mail_error *error_r);
#endif