mail-storage-private.h revision 5137d2d80255938a0f5fb8f3c1a21b34cf11ada3
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* Called after mail storage has been created */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncextern void (*hook_mail_storage_created)(struct mail_storage *storage);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* Called after mailbox has been opened */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncextern void (*hook_mailbox_opened)(struct mailbox *box);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned int id;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync unsigned int id;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void (*class_init)(void);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void (*class_deinit)(void);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*create)(struct mail_storage *storage, const char *data);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync bool (*autodetect)(const char *data, enum mail_storage_flags flags);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync struct mailbox *(*mailbox_open)(struct mail_storage *storage,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char *name,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*mailbox_create)(struct mail_storage *storage, const char *name,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char *name;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* private: */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char *user; /* name of user accessing the storage */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /* Module-specific contexts. See mail_storage_module_id. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ARRAY_DEFINE(module_contexts, union mail_storage_module_context *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /* IMAP: Give a BAD reply instead of NO */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /* Internal temporary error, as opposed to visible user errors like
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync "permission denied" or "out of disk space" */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*get_status)(struct mailbox *box, enum mailbox_status_items items,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*sync_deinit)(struct mailbox_sync_context *ctx,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void (*sync_notify)(struct mailbox *box, uint32_t uid,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*transaction_commit)(struct mailbox_transaction_context *t,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void (*transaction_rollback)(struct mailbox_transaction_context *t);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (*keywords_create)(struct mailbox_transaction_context *t,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char *const keywords[]);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void (*keywords_free)(struct mailbox_transaction_context *t,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*get_uids)(struct mailbox *box, uint32_t uid1, uint32_t uid2,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (*mail_alloc)(struct mailbox_transaction_context *t,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char *const headers[]);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void (*header_lookup_deinit)(struct mailbox_header_lookup_ctx *ctx);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync (*search_init)(struct mailbox_transaction_context *t,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*search_deinit)(struct mail_search_context *ctx);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*search_next_nonblock)(struct mail_search_context *ctx,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /* Internal search function which updates ctx->seq */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*search_next_update_seq)(struct mail_search_context *ctx);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*save_init)(struct mailbox_transaction_context *t,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*save_continue)(struct mail_save_context *ctx);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync void (*save_cancel)(struct mail_save_context *ctx);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*copy)(struct mailbox_transaction_context *t, struct mail *mail,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync enum mail_flags flags, struct mail_keywords *keywords,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* private: */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /* Mailbox notification settings: */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /* Module-specific contexts. See mail_storage_module_id. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ARRAY_DEFINE(module_contexts, union mailbox_module_context *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync /* When FAST open flag is used, the mailbox isn't actually opened until
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync it's synced for the first time. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char *const *(*get_keywords)(struct mail *mail);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const struct message_part *(*get_parts)(struct mail *mail);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync time_t (*get_date)(struct mail *mail, int *timezone);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char *(*get_first_header)(struct mail *mail, const char *field);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync const char *const *(*get_headers)(struct mail *mail, const char *field);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*update_flags)(struct mail *mail, enum modify_type modify_type,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync int (*update_keywords)(struct mail *mail, enum modify_type modify_type,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ARRAY_DEFINE(module_contexts, union mail_module_context *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync ARRAY_DEFINE(module_contexts, union mail_search_module_context *);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* Modules should use do "my_id = mail_storage_module_id++" and
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync use objects' module_contexts[id] for their own purposes. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncextern struct mail_storage_module_register mail_storage_module_register;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* Storage's module_id for mail_index. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncextern struct mail_module_register mail_module_register;
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync MODULE_CONTEXT(obj, mail_storage_mail_index_module)
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncextern MODULE_CONTEXT_DEFINE(mail_storage_mail_index_module,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync/* Set error message in storage. Critical errors are logged with i_error(),
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync but user sees only "internal error" message. */
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid mail_storage_clear_error(struct mail_storage *storage);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid mail_storage_set_error(struct mail_storage *storage,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid mail_storage_set_syntax_error(struct mail_storage *storage,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid mail_storage_set_critical(struct mail_storage *storage,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncvoid mail_storage_set_internal_error(struct mail_storage *storage);
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsyncconst char *mail_storage_class_get_last_error(struct mail_storage *storage,