mailbox-list.h revision 547847191d4a95cd267fc846a1ca3c2111214719
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi /* maildir_name must always be empty */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi /* Mailboxes are files, not directories. */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi /* Internally used by lib-storage */
39435f00a35a276d329283179b3e7e0351482939Timo Sirainen /* Ignore index file and ACLs (used by ACL plugin internally) */
39435f00a35a276d329283179b3e7e0351482939Timo Sirainen /* Use virtual mailbox names (virtual separators and namespace
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi prefixes) for patterns and for returned mailbox names. */
39435f00a35a276d329283179b3e7e0351482939Timo Sirainen /* For mailbox_list_iter_init_namespaces(): Skip namespaces that
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi have alias_for set. */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi /* List only subscribed mailboxes */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi /* Return MAILBOX_CHILD_* if mailbox's children match selection
fe4a5467c998dfd79a071416068ca59d5a6a388fTimo Sirainen criteria, even if the mailbox itself wouldn't match. */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi MAILBOX_LIST_ITER_SELECT_RECURSIVEMATCH = 0x000020,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi /* Don't return any flags unless it can be done without cost */
39435f00a35a276d329283179b3e7e0351482939Timo Sirainen /* Return MAILBOX_SUBSCRIBED flag */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi /* Return children flags */
39435f00a35a276d329283179b3e7e0351482939Timo Sirainen /* Return directory's path (eg. ~/dbox/INBOX) */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi /* Return mailbox path (eg. ~/dbox/INBOX/dbox-Mails) */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi /* Return control directory */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi /* Return index file directory */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi const char *layout; /* FIXME: shouldn't be here */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi /* If non-empty, it means that mails exist in a maildir_name
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi subdirectory. eg. if you have a directory containing directories:
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi If mailbox_name is empty, you have mailboxes "mail", "mail/foo" and
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi If mailbox_name is "Maildir", you have a non-selectable mailbox
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi "mail" and a selectable mailbox "mail/foo". */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi /* if set, store mailboxes under root_dir/mailbox_dir_name/.
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi this setting contains either "" or "dir/". */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi const char *name;
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi/* register all drivers */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomivoid mailbox_list_register(const struct mailbox_list *list);
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomivoid mailbox_list_unregister(const struct mailbox_list *list);
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi/* Returns 0 if ok, -1 if driver was unknown. */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomiint mailbox_list_create(const char *driver, struct mail_namespace *ns,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi enum mailbox_list_flags flags, const char **error_r);
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomivoid mailbox_list_destroy(struct mailbox_list **list);
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomimailbox_list_get_driver_name(const struct mailbox_list *list) ATTR_PURE;
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomichar mailbox_list_get_hierarchy_sep(const struct mailbox_list *list) ATTR_PURE;
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomimailbox_list_get_flags(const struct mailbox_list *list) ATTR_PURE;
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomimailbox_list_get_namespace(const struct mailbox_list *list) ATTR_PURE;
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomimailbox_list_get_user(const struct mailbox_list *list) ATTR_PURE;
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomiint mailbox_list_get_storage(struct mailbox_list **list, const char **name,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomivoid mailbox_list_get_closest_storage(struct mailbox_list *list,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi/* Returns the mode and GID that should be used when creating new files to
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi the specified mailbox, or to mailbox list root if name is NULL. (gid_t)-1 is
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi returned if it's not necessary to change the default gid. */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomivoid mailbox_list_get_permissions(struct mailbox_list *list, const char *name,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi/* Like mailbox_list_get_permissions(), but add execute-bits for mode
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi if either read or write bit is set (e.g. 0640 -> 0750). */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomivoid mailbox_list_get_dir_permissions(struct mailbox_list *list,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi const char *name,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi/* Returns TRUE if the name doesn't contain any invalid characters.
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi The create name check can be more strict. */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomibool mailbox_list_is_valid_pattern(struct mailbox_list *list,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi const char *pattern);
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomibool mailbox_list_is_valid_existing_name(struct mailbox_list *list,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi const char *name);
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomibool mailbox_list_is_valid_create_name(struct mailbox_list *list,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi const char *name);
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi/* Return full path for the given mailbox name. The name must be a valid
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi existing mailbox name, or NULL to get the root directory.
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi For INDEX=MEMORY it returns "" as the path. */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomiconst char *mailbox_list_get_path(struct mailbox_list *list, const char *name,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi/* Returns mailbox name status */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomiint mailbox_list_get_mailbox_name_status(struct mailbox_list *list,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi const char *name,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi/* Returns a prefix that temporary files should use without conflicting
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi with the namespace. */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomiconst char *mailbox_list_get_temp_prefix(struct mailbox_list *list);
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi/* Returns prefix that's common to all get_temp_prefix() calls.
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi Typically this returns either "temp." or ".temp.". */
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomiconst char *mailbox_list_get_global_temp_prefix(struct mailbox_list *list);
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi/* Returns a single pattern from given reference and pattern. */
5f1d689131a75c39f064cbd4202373e7edf78f18Josef 'Jeff' Sipekconst char *mailbox_list_join_refpattern(struct mailbox_list *list,
fe4a5467c998dfd79a071416068ca59d5a6a388fTimo Sirainen/* Initialize new mailbox list request. Pattern may contain '%' and '*'
fe4a5467c998dfd79a071416068ca59d5a6a388fTimo Sirainen wildcards as defined by RFC-3501. */
fe4a5467c998dfd79a071416068ca59d5a6a388fTimo Sirainenmailbox_list_iter_init(struct mailbox_list *list, const char *pattern,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi/* Like mailbox_list_iter_init(), but support multiple patterns. Patterns is
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi a NULL-terminated list of strings. It must contain at least one pattern. */
3bc5b80ae9075e5d940616553f81e8acdd4bd88fTimo Sirainenmailbox_list_iter_init_multiple(struct mailbox_list *list,
3bc5b80ae9075e5d940616553f81e8acdd4bd88fTimo Sirainen const char *const *patterns,
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi/* List mailbox_list_iter_init_multiple(), but list mailboxes from all the
08c0bffa1c9ccb1ac67689093f3c99cd38cfd3a4Aki Tuomi specified namespaces. */
struct mailbox_list_iterate_context *
const char *const *patterns,
const struct mailbox_info *
/* Subscribe/unsubscribe mailbox. There should be no error when
const char *oldname,