mailbox-list-private.h revision 8ca217bf3aa23c7922d0d4aa44fcd2320416d61c
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen#define MAILBOX_LIST_NAME_MAILDIRPLUSPLUS "maildir++"
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen#define MAILBOX_LIST_INDEX_DEFAULT_PREFIX "dovecot.list.index"
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen#define MAILBOX_LOG_FILE_NAME "dovecot.mailbox.log"
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen#define T_MAILBOX_LIST_ERR_NOT_FOUND(list, name) \
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen t_strdup_printf(MAIL_ERRSTR_MAILBOX_NOT_FOUND, \
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen (((flags) & (MAILBOX_SELECT | MAILBOX_NOSELECT | \
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen int (*init)(struct mailbox_list *list, const char **error_r);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen int (*get_storage)(struct mailbox_list **list, const char *vname,
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen char (*get_hierarchy_sep)(struct mailbox_list *list);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen const char *(*get_vname)(struct mailbox_list *list,
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen const char *(*get_storage_name)(struct mailbox_list *list,
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen const char *vname);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen int (*get_path)(struct mailbox_list *list, const char *name,
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen enum mailbox_list_path_type type, const char **path_r);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen const char *(*get_temp_prefix)(struct mailbox_list *list, bool global);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen const char *(*join_refpattern)(struct mailbox_list *list,
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen const char *const *patterns,
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen (*iter_next)(struct mailbox_list_iterate_context *ctx);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen int (*iter_deinit)(struct mailbox_list_iterate_context *ctx);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen int (*get_mailbox_flags)(struct mailbox_list *list,
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen /* Returns TRUE if name is mailbox's internal file/directory.
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen If it does, mailbox deletion assumes it can safely delete it. */
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen bool (*is_internal_name)(struct mailbox_list *list, const char *name);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen /* Read subscriptions from src_list, but place them into
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen dest_list->subscriptions. Set errors to dest_list. */
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen int (*subscriptions_refresh)(struct mailbox_list *src_list,
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen int (*set_subscribed)(struct mailbox_list *list,
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen int (*delete_mailbox)(struct mailbox_list *list, const char *name);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen int (*delete_dir)(struct mailbox_list *list, const char *name);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen int (*delete_symlink)(struct mailbox_list *list, const char *name);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen int (*rename_mailbox)(struct mailbox_list *oldlist, const char *oldname,
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen struct mailbox_list *newlist, const char *newname);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen int (*notify_next)(struct mailbox_list_notify *notify,
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen const struct mailbox_list_notify_rec **rec_r);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen void (*notify_deinit)(struct mailbox_list_notify *notify);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen void (*notify_wait)(struct mailbox_list_notify *notify,
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen void (*callback)(void *context), void *context);
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen unsigned int id;
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen/* private: */
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen /* may not be set yet, use mailbox_list_get_permissions() to access */
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen time_t subscriptions_mtime, subscriptions_read_time;
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen HASH_TABLE(uint8_t *, struct mailbox_guid_cache_rec *) guid_cache;
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen /* Last error set in mailbox_list_set_critical(). */
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen ARRAY(union mailbox_list_module_context *) module_contexts;
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen struct mailbox_list_autocreate_iterate_context *autocreate_ctx;
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen ARRAY(union mailbox_list_iterate_module_context *) module_contexts;
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen struct mailbox_list_iterate_context *iter_ctx;
0c17af9d3f9323136a94e66605776ed4462a172dTimo Sirainen enum mailbox_info_flags leaf_flags, parent_flags;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen/* Modules should use do "my_id = mailbox_list_module_id++" and
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen use objects' module_contexts[id] for their own purposes. */
16f816d3f3c32ae3351834253f52ddd0212bcbf3Timo Sirainenextern struct mailbox_list_module_register mailbox_list_module_register;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenvoid mailbox_list_settings_init_defaults(struct mailbox_list_settings *set_r);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenint mailbox_list_settings_parse(struct mail_user *user, const char *data,
5fb3bff645380804c9db2510940c41db6b8fdb01Timo Sirainen const char **error_r);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenmailbox_list_escape_name(struct mailbox_list *list, const char *vname);
2abfef71398a61e5ed97c23a1ceb71461933ccb8Timo Sirainenmailbox_list_escape_name_params(const char *vname, const char *ns_prefix,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenmailbox_list_unescape_name(struct mailbox_list *list, const char *src);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenmailbox_list_unescape_name_params(const char *src, const char *ns_prefix,
b66a7b7ab0db2c9ad425912d3f21a36fcf76d876Timo Sirainen char ns_sep, char list_sep, char escape_char);
b66a7b7ab0db2c9ad425912d3f21a36fcf76d876Timo Sirainenconst char *mailbox_list_default_get_storage_name(struct mailbox_list *list,
b66a7b7ab0db2c9ad425912d3f21a36fcf76d876Timo Sirainen const char *vname);
b66a7b7ab0db2c9ad425912d3f21a36fcf76d876Timo Sirainenconst char *mailbox_list_default_get_vname(struct mailbox_list *list,
b66a7b7ab0db2c9ad425912d3f21a36fcf76d876Timo Sirainenconst char *mailbox_list_get_unexpanded_path(struct mailbox_list *list,
cbf7138b49d32fce0645dc6523fbb42cc07cb2faTimo Sirainenbool mailbox_list_set_get_root_path(const struct mailbox_list_settings *set,
b9b48aaaebf6f72dfab567cda073cde8a7b26598Timo Sirainen const char **path_r);
992a9e2d6c6ee45d87089ac54267e0198a7802c3Timo Sirainenint mailbox_list_delete_index_control(struct mailbox_list *list,
992a9e2d6c6ee45d87089ac54267e0198a7802c3Timo Sirainen const char *name);
b5e6f6f27c1461f0f9f202615eeb738a645188c3Timo Sirainenvoid mailbox_list_iter_update(struct mailbox_list_iter_update_context *ctx,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen const char *name);
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainenint mailbox_list_iter_subscriptions_refresh(struct mailbox_list *list);
44dc970b18c4e2d06f34cb908924152156e4a45bTimo Sirainenenum mailbox_list_file_type mailbox_list_get_file_type(const struct dirent *d);
44dc970b18c4e2d06f34cb908924152156e4a45bTimo Sirainenint mailbox_list_dirent_is_alias_symlink(struct mailbox_list *list,
d4dcb9c30dba354cff7af6d303ecef7698194c55Timo Sirainen const struct dirent *d);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenbool mailbox_list_try_get_absolute_path(struct mailbox_list *list,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen const char **name);
44dc970b18c4e2d06f34cb908924152156e4a45bTimo Sirainenvoid mailbox_list_add_change(struct mailbox_list *list,
6bf1543bb7af03324c04e8f9ac8e430f395989aeTimo Sirainenvoid mailbox_name_get_sha128(const char *name, guid_128_t guid_128_r);
6bf1543bb7af03324c04e8f9ac8e430f395989aeTimo Sirainenvoid mailbox_list_clear_error(struct mailbox_list *list);
6bf1543bb7af03324c04e8f9ac8e430f395989aeTimo Sirainenvoid mailbox_list_set_error(struct mailbox_list *list,
6bf1543bb7af03324c04e8f9ac8e430f395989aeTimo Sirainenvoid mailbox_list_set_critical(struct mailbox_list *list, const char *fmt, ...)
44dc970b18c4e2d06f34cb908924152156e4a45bTimo Sirainenvoid mailbox_list_set_internal_error(struct mailbox_list *list);