mail-storage-private.h revision ff7056842f14fd3b30a2d327dfab165b9d15dd30
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/* Called after mail storage has been created */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern void (*hook_mail_storage_created)(struct mail_storage *storage);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/* Called after mailbox has been opened */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern void (*hook_mailbox_opened)(struct mailbox *box);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync unsigned int id;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync unsigned int id;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync void (*class_init)(void);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync void (*class_deinit)(void);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*create)(struct mail_storage *storage, const char *data);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync bool (*autodetect)(const char *data, enum mail_storage_flags flags);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync struct mailbox *(*mailbox_open)(struct mail_storage *storage,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync const char *name,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*mailbox_create)(struct mail_storage *storage, const char *name,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync const char *name;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/* private: */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync const char *user; /* name of user accessing the storage */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* Module-specific contexts. See mail_storage_module_id. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ARRAY_DEFINE(module_contexts, union mail_storage_module_context *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*get_status)(struct mailbox *box, enum mailbox_status_items items,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*sync_deinit)(struct mailbox_sync_context *ctx,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* Called once for each expunge. Called one or more times for
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync flag/keyword changes. Once the sync is finished, called with
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync uid=0 and sync_type=0. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync void (*sync_notify)(struct mailbox *box, uint32_t uid,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*transaction_commit)(struct mailbox_transaction_context *t,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync void (*transaction_rollback)(struct mailbox_transaction_context *t);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (*keywords_create)(struct mailbox_transaction_context *t,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync const char *const keywords[]);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync void (*keywords_free)(struct mailbox_transaction_context *t,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*get_uids)(struct mailbox *box, uint32_t uid1, uint32_t uid2,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (*mail_alloc)(struct mailbox_transaction_context *t,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync const char *const headers[]);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync void (*header_lookup_deinit)(struct mailbox_header_lookup_ctx *ctx);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync (*search_init)(struct mailbox_transaction_context *t,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*search_deinit)(struct mail_search_context *ctx);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*search_next_nonblock)(struct mail_search_context *ctx,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* Internal search function which updates ctx->seq */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*search_next_update_seq)(struct mail_search_context *ctx);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*save_init)(struct mailbox_transaction_context *t,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*save_continue)(struct mail_save_context *ctx);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync void (*save_cancel)(struct mail_save_context *ctx);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*copy)(struct mailbox_transaction_context *t, struct mail *mail,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync enum mail_flags flags, struct mail_keywords *keywords,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/* private: */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* Mailbox notification settings: */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* Module-specific contexts. See mail_storage_module_id. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ARRAY_DEFINE(module_contexts, union mailbox_module_context *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /* When FAST open flag is used, the mailbox isn't actually opened until
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync it's synced for the first time. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync const char *const *(*get_keywords)(struct mail *mail);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync const struct message_part *(*get_parts)(struct mail *mail);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync time_t (*get_date)(struct mail *mail, int *timezone);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync const char *(*get_first_header)(struct mail *mail, const char *field);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync const char *const *(*get_headers)(struct mail *mail, const char *field);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*update_flags)(struct mail *mail, enum modify_type modify_type,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync int (*update_keywords)(struct mail *mail, enum modify_type modify_type,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ARRAY_DEFINE(module_contexts, union mail_module_context *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync ARRAY_DEFINE(module_contexts, union mail_search_module_context *);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/* Modules should use do "my_id = mail_storage_module_id++" and
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync use objects' module_contexts[id] for their own purposes. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern struct mail_storage_module_register mail_storage_module_register;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/* Storage's module_id for mail_index. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern struct mail_module_register mail_module_register;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync MODULE_CONTEXT(obj, mail_storage_mail_index_module)
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncextern MODULE_CONTEXT_DEFINE(mail_storage_mail_index_module,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/* Set error message in storage. Critical errors are logged with i_error(),
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync but user sees only "internal error" message. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncvoid mail_storage_clear_error(struct mail_storage *storage);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncvoid mail_storage_set_error(struct mail_storage *storage,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncvoid mail_storage_set_critical(struct mail_storage *storage,
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncvoid mail_storage_set_internal_error(struct mail_storage *storage);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncbool mail_storage_set_error_from_errno(struct mail_storage *storage);