mailbox-list.h revision 472369cba85d9f7c995dda60e7cd01d78b4a960a
02c335c23bf5fa225a467c19f2c063fb0dc7b8c3Timo Sirainen#ifndef MAILBOX_LIST_H
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch#define MAILBOX_LIST_H
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch#include "mail-error.h"
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Boschstruct mail_namespace;
7384b4e78eaab44693c985192276e31322155e32Stephan Boschstruct mail_storage;
7384b4e78eaab44693c985192276e31322155e32Stephan Boschstruct mailbox_list;
7384b4e78eaab44693c985192276e31322155e32Stephan Boschstruct mailbox_list_iterate_context;
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Boschenum mailbox_list_properties {
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch /* maildir_name must always be empty */
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_PROP_NO_MAILDIR_NAME = 0x01
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch};
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Boschenum mailbox_list_flags {
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch /* Mailboxes are files, not directories. */
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_FLAG_MAILBOX_FILES = 0x01
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch};
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Boschenum mailbox_info_flags {
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_NOSELECT = 0x001,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_NONEXISTENT = 0x002,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_CHILDREN = 0x004,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_NOCHILDREN = 0x008,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_NOINFERIORS = 0x010,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_MARKED = 0x020,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_UNMARKED = 0x040,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_SUBSCRIBED = 0x080,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_CHILD_SUBSCRIBED = 0x100,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch /* Internally used by lib-storage */
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_MATCHED = 0x40000000
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch};
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch
de96afeeaa5242cffe89f1966457e935806b5746Stephan Boschenum mailbox_name_status {
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_NAME_EXISTS,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_NAME_VALID,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_NAME_INVALID,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_NAME_NOINFERIORS
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch};
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch
de96afeeaa5242cffe89f1966457e935806b5746Stephan Boschenum mailbox_list_iter_flags {
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch /* Ignore index file and ACLs (used by ACL plugin internally) */
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_LIST_ITER_RAW_LIST = 0x000001,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch /* Use virtual mailbox names (virtual separators and namespace
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch prefixes) for patterns and for returned mailbox names. */
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_LIST_ITER_VIRTUAL_NAMES = 0x000002,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch /* For mailbox_list_iter_init_namespaces(): Skip namespaces that
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch have alias_for set. */
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_LIST_ITER_SKIP_ALIASES = 0x000004,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch /* List only subscribed mailboxes */
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_LIST_ITER_SELECT_SUBSCRIBED = 0x000010,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch /* Return MAILBOX_CHILD_* if mailbox's children match selection
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch criteria, even if the mailbox itself wouldn't match. */
6ee9ce5ed955a1283dc22ad28980bf9cc23d4c4eStephan Bosch MAILBOX_LIST_ITER_SELECT_RECURSIVEMATCH = 0x000020,
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch /* Don't return any flags unless it can be done without cost */
de96afeeaa5242cffe89f1966457e935806b5746Stephan Bosch MAILBOX_LIST_ITER_RETURN_NO_FLAGS = 0x001000,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch /* Return MAILBOX_SUBSCRIBED flag */
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_ITER_RETURN_SUBSCRIBED = 0x002000,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch /* Return children flags */
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_ITER_RETURN_CHILDREN = 0x004000
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch};
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Boschenum mailbox_list_path_type {
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch /* Return directory's path (eg. ~/dbox/INBOX) */
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_PATH_TYPE_DIR,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch /* Return mailbox path (eg. ~/dbox/INBOX/dbox-Mails) */
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_PATH_TYPE_MAILBOX,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch /* Return control directory */
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_PATH_TYPE_CONTROL,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch /* Return index file directory */
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_PATH_TYPE_INDEX
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch};
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Boschenum mailbox_list_file_type {
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_FILE_TYPE_UNKNOWN = 0,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_FILE_TYPE_FILE,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_FILE_TYPE_DIR,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_FILE_TYPE_SYMLINK,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch MAILBOX_LIST_FILE_TYPE_OTHER
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch};
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Boschstruct mailbox_list_settings {
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *layout; /* FIXME: shouldn't be here */
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *root_dir;
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *index_dir;
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *control_dir;
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *alt_dir; /* FIXME: dbox-specific.. */
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *inbox_path;
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *subscription_fname;
c275cef636c79e1d08b3a82462c4abdca6f8cef3Martti Rannanjärvi /* If non-empty, it means that mails exist in a maildir_name
7944646fad6aa1e7c649c3d33e454c516b0220b6Timo Sirainen subdirectory. eg. if you have a directory containing directories:
b99130e4cf4af4e6b103b949456222f3a2dff424Timo Sirainen
b99130e4cf4af4e6b103b949456222f3a2dff424Timo Sirainen mail/
b99130e4cf4af4e6b103b949456222f3a2dff424Timo Sirainen mail/foo/
b99130e4cf4af4e6b103b949456222f3a2dff424Timo Sirainen mail/foo/Maildir
c275cef636c79e1d08b3a82462c4abdca6f8cef3Martti Rannanjärvi
5d31e4b38ef03b002e2ab245a7f8a4c0da3dd03dTimo Sirainen If mailbox_name is empty, you have mailboxes "mail", "mail/foo" and
5d31e4b38ef03b002e2ab245a7f8a4c0da3dd03dTimo Sirainen "mail/foo/Maildir".
4219de12b28f1936219e27501b9c4b27a4f8d53cStephan Bosch
4219de12b28f1936219e27501b9c4b27a4f8d53cStephan Bosch If mailbox_name is "Maildir", you have a non-selectable mailbox
4219de12b28f1936219e27501b9c4b27a4f8d53cStephan Bosch "mail" and a selectable mailbox "mail/foo". */
4219de12b28f1936219e27501b9c4b27a4f8d53cStephan Bosch const char *maildir_name;
4219de12b28f1936219e27501b9c4b27a4f8d53cStephan Bosch /* if set, store mailboxes under root_dir/mailbox_dir_name/.
4219de12b28f1936219e27501b9c4b27a4f8d53cStephan Bosch this setting contains either "" or "dir/". */
4c4c4a740bbb1b674d4b0dae009d1919f8ad96b7Stephan Bosch const char *mailbox_dir_name;
4c4c4a740bbb1b674d4b0dae009d1919f8ad96b7Stephan Bosch};
4c4c4a740bbb1b674d4b0dae009d1919f8ad96b7Stephan Bosch
4c4c4a740bbb1b674d4b0dae009d1919f8ad96b7Stephan Boschstruct mailbox_info {
4c4c4a740bbb1b674d4b0dae009d1919f8ad96b7Stephan Bosch const char *name;
4c4c4a740bbb1b674d4b0dae009d1919f8ad96b7Stephan Bosch enum mailbox_info_flags flags;
4c4c4a740bbb1b674d4b0dae009d1919f8ad96b7Stephan Bosch struct mail_namespace *ns;
4c4c4a740bbb1b674d4b0dae009d1919f8ad96b7Stephan Bosch};
4c4c4a740bbb1b674d4b0dae009d1919f8ad96b7Stephan Bosch
4219de12b28f1936219e27501b9c4b27a4f8d53cStephan Bosch/* register all drivers */
7384b4e78eaab44693c985192276e31322155e32Stephan Boschvoid mailbox_list_register_all(void);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Boschvoid mailbox_list_register(const struct mailbox_list *list);
7384b4e78eaab44693c985192276e31322155e32Stephan Boschvoid mailbox_list_unregister(const struct mailbox_list *list);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch/* Returns 0 if ok, -1 if driver was unknown. */
9d746c6785d17e421c3f3c74cf29d059ae2ab233Stephan Boschint mailbox_list_create(const char *driver, struct mail_namespace *ns,
fe2b0e3de834dd40b698bb579adc5357d5789ec9Stephan Bosch const struct mailbox_list_settings *set,
fe2b0e3de834dd40b698bb579adc5357d5789ec9Stephan Bosch enum mailbox_list_flags flags, const char **error_r);
fe2b0e3de834dd40b698bb579adc5357d5789ec9Stephan Boschvoid mailbox_list_destroy(struct mailbox_list **list);
fe2b0e3de834dd40b698bb579adc5357d5789ec9Stephan Bosch
94d1b08c9e20d637db568a3eab3dfc2b9e96e62aStephan Boschconst char *
94d1b08c9e20d637db568a3eab3dfc2b9e96e62aStephan Boschmailbox_list_get_driver_name(const struct mailbox_list *list) ATTR_PURE;
94d1b08c9e20d637db568a3eab3dfc2b9e96e62aStephan Boschchar mailbox_list_get_hierarchy_sep(const struct mailbox_list *list) ATTR_PURE;
94d1b08c9e20d637db568a3eab3dfc2b9e96e62aStephan Boschenum mailbox_list_flags
ad03049781fc14807248007d524be4daf06c3ee2Stephan Boschmailbox_list_get_flags(const struct mailbox_list *list) ATTR_PURE;
486c7c8d9e725e0227c7723aa43b7fce724eb9eeStephan Boschstruct mail_namespace *
e47c2f17d8136c4d972d1074a3f84ba2ecef4fdcStephan Boschmailbox_list_get_namespace(const struct mailbox_list *list) ATTR_PURE;
7384b4e78eaab44693c985192276e31322155e32Stephan Boschstruct mail_user *
feba5e502b2131c9a1c766b7ef9ff041dbf71d1dStephan Boschmailbox_list_get_user(const struct mailbox_list *list) ATTR_PURE;
b66def5dadd3e7c250313a938d26ad113663f86bStephan Boschint mailbox_list_get_storage(struct mailbox_list **list, const char **name,
b66def5dadd3e7c250313a938d26ad113663f86bStephan Bosch struct mail_storage **storage_r);
5257840e8d31a6cb7051703b4cb0931c82aba638Stephan Boschvoid mailbox_list_get_closest_storage(struct mailbox_list *list,
5257840e8d31a6cb7051703b4cb0931c82aba638Stephan Bosch struct mail_storage **storage);
5257840e8d31a6cb7051703b4cb0931c82aba638Stephan Bosch
5257840e8d31a6cb7051703b4cb0931c82aba638Stephan Bosch/* Returns the mode and GID that should be used when creating new files to
a8c4e79ff50fac21b05a7368b052583d410ca15cTimo Sirainen the specified mailbox, or to mailbox list root if name is NULL. (gid_t)-1 is
70505f4839520ac67895992621c97d2480c22e7fTimo Sirainen returned if it's not necessary to change the default gid. */
93cc87bb22386e020cee1093b6bd59295e0b33f0Stephan Boschvoid mailbox_list_get_permissions(struct mailbox_list *list,
c972eaa3565e849df71b44cf0cd45d38c5567d07Stephan Bosch const char *name,
c972eaa3565e849df71b44cf0cd45d38c5567d07Stephan Bosch mode_t *mode_r, gid_t *gid_r,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char **gid_origin_r);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch/* Like mailbox_list_get_permissions(), but add execute-bits for mode
fca68889b287d8eed4babe72a231bd6079da012dStephan Bosch if either read or write bit is set (e.g. 0640 -> 0750). */
fca68889b287d8eed4babe72a231bd6079da012dStephan Boschvoid mailbox_list_get_dir_permissions(struct mailbox_list *list,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *name,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch mode_t *mode_r, gid_t *gid_r,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char **gid_origin_r);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch/* Create path's parent directory with proper permissions. Since most
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch directories are created lazily, this function can be used to easily create
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch them whenever file creation fails with ENOENT. */
7384b4e78eaab44693c985192276e31322155e32Stephan Boschint mailbox_list_create_parent_dir(struct mailbox_list *list,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *mailbox, const char *path);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch/* Returns TRUE if the name doesn't contain any invalid characters.
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch The create name check can be more strict. */
7384b4e78eaab44693c985192276e31322155e32Stephan Boschbool mailbox_list_is_valid_pattern(struct mailbox_list *list,
6ab81c81be13f33486746deeffe02a1ef2bcc821Stephan Bosch const char *pattern);
7384b4e78eaab44693c985192276e31322155e32Stephan Boschbool mailbox_list_is_valid_existing_name(struct mailbox_list *list,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *name);
7384b4e78eaab44693c985192276e31322155e32Stephan Boschbool mailbox_list_is_valid_create_name(struct mailbox_list *list,
f9d2a1f21ad65262bc630f0834d7eead06a1bac3Timo Sirainen const char *name);
f9d2a1f21ad65262bc630f0834d7eead06a1bac3Timo Sirainen
6ab81c81be13f33486746deeffe02a1ef2bcc821Stephan Bosch/* Return full path for the given mailbox name. The name must be a valid
6ab81c81be13f33486746deeffe02a1ef2bcc821Stephan Bosch existing mailbox name, or NULL to get the root directory.
6ab81c81be13f33486746deeffe02a1ef2bcc821Stephan Bosch For INDEX=MEMORY it returns "" as the path. */
6ab81c81be13f33486746deeffe02a1ef2bcc821Stephan Boschconst char *mailbox_list_get_path(struct mailbox_list *list, const char *name,
6ab81c81be13f33486746deeffe02a1ef2bcc821Stephan Bosch enum mailbox_list_path_type type);
6ab81c81be13f33486746deeffe02a1ef2bcc821Stephan Bosch/* Returns mailbox name status */
fca68889b287d8eed4babe72a231bd6079da012dStephan Boschint mailbox_list_get_mailbox_name_status(struct mailbox_list *list,
6ab81c81be13f33486746deeffe02a1ef2bcc821Stephan Bosch const char *name,
fca68889b287d8eed4babe72a231bd6079da012dStephan Bosch enum mailbox_name_status *status);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
9dc01e0d10a61cab14867b26bf0d2d1dcf8ad978Timo Sirainen/* Returns a prefix that temporary files should use without conflicting
9dc01e0d10a61cab14867b26bf0d2d1dcf8ad978Timo Sirainen with the namespace. */
ebe0f5e387744621b73c4db79d5891ccbe0a1321Stephan Boschconst char *mailbox_list_get_temp_prefix(struct mailbox_list *list);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch/* Returns prefix that's common to all get_temp_prefix() calls.
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch Typically this returns either "temp." or ".temp.". */
7384b4e78eaab44693c985192276e31322155e32Stephan Boschconst char *mailbox_list_get_global_temp_prefix(struct mailbox_list *list);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
aacf2a69acc59e9382578d6f4e030788abc79706Timo Sirainen/* Returns a single pattern from given reference and pattern. */
aacf2a69acc59e9382578d6f4e030788abc79706Timo Sirainenconst char *mailbox_list_join_refpattern(struct mailbox_list *list,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *ref, const char *pattern);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch/* Initialize new mailbox list request. Pattern may contain '%' and '*'
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch wildcards as defined by RFC-3501. */
6ab81c81be13f33486746deeffe02a1ef2bcc821Stephan Boschstruct mailbox_list_iterate_context *
6ab81c81be13f33486746deeffe02a1ef2bcc821Stephan Boschmailbox_list_iter_init(struct mailbox_list *list, const char *pattern,
6ab81c81be13f33486746deeffe02a1ef2bcc821Stephan Bosch enum mailbox_list_iter_flags flags);
6ab81c81be13f33486746deeffe02a1ef2bcc821Stephan Bosch/* Like mailbox_list_iter_init(), but support multiple patterns. Patterns is
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch a NULL-terminated list of strings. It must contain at least one pattern. */
415e16c3dc185578695b7d88e561a52de6c8b1b1Timo Sirainenstruct mailbox_list_iterate_context *
415e16c3dc185578695b7d88e561a52de6c8b1b1Timo Sirainenmailbox_list_iter_init_multiple(struct mailbox_list *list,
415e16c3dc185578695b7d88e561a52de6c8b1b1Timo Sirainen const char *const *patterns,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch enum mailbox_list_iter_flags flags);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch/* List mailbox_list_iter_init_multiple(), but list mailboxes from all the
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch specified namespaces. */
7384b4e78eaab44693c985192276e31322155e32Stephan Boschstruct mailbox_list_iterate_context *
7384b4e78eaab44693c985192276e31322155e32Stephan Boschmailbox_list_iter_init_namespaces(struct mail_namespace *namespaces,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *const *patterns,
636d0f43138468f8efe685a681326b123f660e49Timo Sirainen enum mailbox_list_iter_flags flags);
fc94140acba51adafedafbc8491a3223a51db7a8Stephan Bosch/* Get next mailbox. Returns the mailbox name */
7384b4e78eaab44693c985192276e31322155e32Stephan Boschconst struct mailbox_info *
7384b4e78eaab44693c985192276e31322155e32Stephan Boschmailbox_list_iter_next(struct mailbox_list_iterate_context *ctx);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch/* Deinitialize mailbox list request. Returns -1 if some error
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch occurred while listing. */
7384b4e78eaab44693c985192276e31322155e32Stephan Boschint mailbox_list_iter_deinit(struct mailbox_list_iterate_context **ctx);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch/* Subscribe/unsubscribe mailbox. There should be no error when
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch subscribing to already subscribed mailbox. Subscribing to
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch unexisting mailboxes is optional. */
7384b4e78eaab44693c985192276e31322155e32Stephan Boschint mailbox_list_set_subscribed(struct mailbox_list *list,
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch const char *name, bool set);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
fc94140acba51adafedafbc8491a3223a51db7a8Stephan Bosch/* Delete the given mailbox. If it has children, they aren't deleted. */
fc94140acba51adafedafbc8491a3223a51db7a8Stephan Boschint mailbox_list_delete_mailbox(struct mailbox_list *list, const char *name);
fc94140acba51adafedafbc8491a3223a51db7a8Stephan Bosch/* Rename mailbox. Renaming across different mailbox lists is possible only
fc94140acba51adafedafbc8491a3223a51db7a8Stephan Bosch between private namespaces and storages of the same type. If the rename
636d0f43138468f8efe685a681326b123f660e49Timo Sirainen fails, the error is set to oldlist. */
636d0f43138468f8efe685a681326b123f660e49Timo Sirainenint mailbox_list_rename_mailbox(struct mailbox_list *oldlist,
636d0f43138468f8efe685a681326b123f660e49Timo Sirainen const char *oldname,
fca68889b287d8eed4babe72a231bd6079da012dStephan Bosch struct mailbox_list *newlist,
fca68889b287d8eed4babe72a231bd6079da012dStephan Bosch const char *newname, bool rename_children);
fca68889b287d8eed4babe72a231bd6079da012dStephan Bosch
fca68889b287d8eed4babe72a231bd6079da012dStephan Bosch/* Returns the error message of last occurred error. */
fca68889b287d8eed4babe72a231bd6079da012dStephan Boschconst char *mailbox_list_get_last_error(struct mailbox_list *list,
fca68889b287d8eed4babe72a231bd6079da012dStephan Bosch enum mail_error *error_r);
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch#endif
7384b4e78eaab44693c985192276e31322155e32Stephan Bosch