mailbox-list.h revision 61e84692827b6a64912343f515c984853021483a
a371ea8bd48d45548cd7aa16d4f5aeb38ba48c91Aki Tuomi /* Print debugging information while initializing the driver */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi /* Allow full filesystem access with absolute or relative paths. */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi /* Rely on O_EXCL when creating dotlocks */
03c6532fe7aa3ddae23c99ff6bec78d8dd2e8165Aki Tuomi /* List only subscribed mailboxes */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi /* Don't return any flags unless it can be done without cost */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi /* Return children flags */
03c6532fe7aa3ddae23c99ff6bec78d8dd2e8165Aki Tuomi /* Ignore index file and ACLs (used by ACL plugin internally) */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi /* Return directory's path (eg. ~/dbox/INBOX) */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi /* Return mailbox path (eg. ~/dbox/INBOX/dbox-Mails) */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi /* Return control directory */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi /* Return index file directory */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi /* If non-empty, it means that mails exist in a maildir_name
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi subdirectory. eg. if you have a directory containing directories:
03c6532fe7aa3ddae23c99ff6bec78d8dd2e8165Aki Tuomi If mailbox_name is empty, you have mailboxes "mail", "mail/foo" and
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi If mailbox_name is "Maildir", you have a non-selectable mailbox
7c9ae3d919ba59af5be3193a80ece4871a0d700cAki Tuomi "mail" and a selectable mailbox "mail/foo". */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi /* If mailbox index is used, use these settings for it
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi (pointers, so they're set to NULL after init is finished): */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi const enum mail_storage_flags *mail_storage_flags;
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi const char *name;
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi/* register all drivers */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomivoid mailbox_list_register(const struct mailbox_list *list);
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomivoid mailbox_list_unregister(const struct mailbox_list *list);
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi/* Returns 0 if ok, -1 if initialization failed. */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomiint mailbox_list_init(struct mail_namespace *ns, const char *driver,
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi struct mailbox_list **list_r, const char **error_r);
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomivoid mailbox_list_deinit(struct mailbox_list *list);
204ee6ed414f5e4eeb6f6c10763b55daf56f11acJosef 'Jeff' Sipekconst char *mailbox_list_get_driver_name(struct mailbox_list *list);
5f1d689131a75c39f064cbd4202373e7edf78f18Josef 'Jeff' Sipekchar mailbox_list_get_hierarchy_sep(struct mailbox_list *list);
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomienum mailbox_list_flags mailbox_list_get_flags(struct mailbox_list *list);
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomistruct mail_namespace *mailbox_list_get_namespace(struct mailbox_list *list);
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi/* Returns TRUE if the name doesn't contain any invalid characters.
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi The create name check can be more strict. */
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomibool mailbox_list_is_valid_mask(struct mailbox_list *list, const char *mask);
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomibool mailbox_list_is_valid_existing_name(struct mailbox_list *list,
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi const char *name);
a371ea8bd48d45548cd7aa16d4f5aeb38ba48c91Aki Tuomibool mailbox_list_is_valid_create_name(struct mailbox_list *list,
a371ea8bd48d45548cd7aa16d4f5aeb38ba48c91Aki Tuomi const char *name);
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi/* Return full path for the given mailbox name. The name must be a valid
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi existing mailbox name, or NULL to get the root directory.
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi For INDEX=MEMORY it returns "" as the path. */
be5773cb4d6edae8a5d9f300c3c7375cdd33826eJosef 'Jeff' Sipekconst char *mailbox_list_get_path(struct mailbox_list *list, const char *name,
5f1d689131a75c39f064cbd4202373e7edf78f18Josef 'Jeff' Sipek/* Returns the mode, UID and GID that should be used when creating new files
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi to the given mailbox. (uid_t)-1 and (gid_t)-1 is returned if it's not
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi necessary to change the default UID or GID. The name must be a valid
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi existing mailbox name, or NULL to get global permissions.
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi Returns -1 if error, 0 if mailbox not found, 1 if ok. */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomiint mailbox_list_get_permissions(struct mailbox_list *list, const char *name,
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi/* Returns mailbox name status */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomiint mailbox_list_get_mailbox_name_status(struct mailbox_list *list,
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi const char *name,
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi/* Returns a prefix that temporary files should use without conflicting
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi with the namespace. */
98bc2ecdbfd4f2f20c3a5e96ae445072fbe22223Aki Tuomiconst char *mailbox_list_get_temp_prefix(struct mailbox_list *list);
98bc2ecdbfd4f2f20c3a5e96ae445072fbe22223Aki Tuomi/* Returns a single mask from given reference and mask. */
98bc2ecdbfd4f2f20c3a5e96ae445072fbe22223Aki Tuomiconst char *mailbox_list_join_refmask(struct mailbox_list *list,
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi/* Initialize new mailbox list request. mask may contain '%' and '*'
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi wildcards as defined by RFC-3501. */
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomimailbox_list_iter_init(struct mailbox_list *list, const char *mask,
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomi/* Get next mailbox. Returns the mailbox name */
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomimailbox_list_iter_next(struct mailbox_list_iterate_context *ctx);
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomi/* Deinitialize mailbox list request. Returns FALSE if some error
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomi occurred while listing. */
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomiint mailbox_list_iter_deinit(struct mailbox_list_iterate_context **ctx);
5f1d689131a75c39f064cbd4202373e7edf78f18Josef 'Jeff' Sipek/* Subscribe/unsubscribe mailbox. There should be no error when
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomi subscribing to already subscribed mailbox. Subscribing to
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomi unexisting mailboxes is optional. */
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomiint mailbox_list_set_subscribed(struct mailbox_list *list,
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomi/* Delete the given mailbox. If it has children, they aren't deleted. */
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomiint mailbox_list_delete_mailbox(struct mailbox_list *list, const char *name);
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomi/* If the name has inferior hierarchical names, then the inferior
097dbdf543bc5d1689c5570f5faaec1e864e3a87Aki Tuomi hierarchical names MUST also be renamed (ie. foo -> bar renames
1be27c35ea17fccd83c54e2acc66eb8c44d1a8feAki Tuomi also foo/bar -> bar/bar). newname may contain multiple new
1be27c35ea17fccd83c54e2acc66eb8c44d1a8feAki Tuomi hierarchies.
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi If oldname is case-insensitively "INBOX", the mails are moved
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi into new mailbox but the INBOX mailbox must not be deleted. */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomiint mailbox_list_rename_mailbox(struct mailbox_list *list,
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomi/* Returns the error message of last occurred error. */
4036c1ca99d2c517f68a5b67a419ae7fdfd45300Aki Tuomiconst char *mailbox_list_get_last_error(struct mailbox_list *list,