mail-storage-private.h revision 6ef7e31619edfaa17ed044b45861d106a86191ef
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen/* Modules should use do "my_id = mail_storage_module_id++" and
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen use objects' module_contexts[id] for their own purposes. */
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainenextern unsigned int mail_storage_module_id;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen void (*destroy)(struct mail_storage *storage);
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainen bool (*autodetect)(const char *data, enum mail_storage_flags flags);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen void (*set_callbacks)(struct mail_storage *storage,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen struct mailbox *(*mailbox_open)(struct mail_storage *storage,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen int (*mailbox_create)(struct mail_storage *storage, const char *name,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen int (*mailbox_delete)(struct mail_storage *storage, const char *name);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen int (*mailbox_rename)(struct mail_storage *storage, const char *oldname,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen const char *newname);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen (*mailbox_list_init)(struct mail_storage *storage,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen (*mailbox_list_next)(struct mailbox_list_context *ctx);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen int (*mailbox_list_deinit)(struct mailbox_list_context *ctx);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen int (*set_subscribed)(struct mail_storage *storage,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen int (*get_mailbox_name_status)(struct mail_storage *storage,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen const char *(*get_last_error)(struct mail_storage *storage,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen/* private: */
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen /* Module-specific contexts. See mail_storage_module_id. */
ab0155cbec1286e1cd00a0e01d78e0f3ca34cea6Timo Sirainen /* IMAP: Give a BAD reply instead of NO */
ab0155cbec1286e1cd00a0e01d78e0f3ca34cea6Timo Sirainen /* Internal temporary error, as opposed to visible user errors like
ab0155cbec1286e1cd00a0e01d78e0f3ca34cea6Timo Sirainen "permission denied" or "out of disk space" */
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainen bool (*allow_new_keywords)(struct mailbox *box);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen int (*get_status)(struct mailbox *box, enum mailbox_status_items items,
d756ebcfa96bd7cff02097c8f26df9df368b81b1Timo Sirainen int (*sync_next)(struct mailbox_sync_context *ctx,
d756ebcfa96bd7cff02097c8f26df9df368b81b1Timo Sirainen int (*sync_deinit)(struct mailbox_sync_context *ctx,
d756ebcfa96bd7cff02097c8f26df9df368b81b1Timo Sirainen void (*notify_changes)(struct mailbox *box, unsigned int min_interval,
b2c1349cf07410aefab0f5b17153af9e5cfcf48fTimo Sirainen int (*transaction_commit)(struct mailbox_transaction_context *t,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen void (*transaction_rollback)(struct mailbox_transaction_context *t);
16c89b1260c9d07c01c83a9219424d3727069b2eTimo Sirainen (*keywords_create)(struct mailbox_transaction_context *t,
16c89b1260c9d07c01c83a9219424d3727069b2eTimo Sirainen const char *const keywords[]);
faed8babca9914257f34fb2e603d74016d563b2dTimo Sirainen void (*keywords_free)(struct mailbox_transaction_context *t,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen int (*get_uids)(struct mailbox *box, uint32_t uid1, uint32_t uid2,
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen (*mail_alloc)(struct mailbox_transaction_context *t,
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen struct mailbox_header_lookup_ctx *wanted_headers);
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen const char *const headers[]);
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen void (*header_lookup_deinit)(struct mailbox_header_lookup_ctx *ctx);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen int (*search_get_sorting)(struct mailbox *box,
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen (*search_init)(struct mailbox_transaction_context *t,
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen const char *charset, struct mail_search_arg *args,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen int (*search_deinit)(struct mail_search_context *ctx);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen int (*search_next)(struct mail_search_context *ctx, struct mail *mail);
a423d985ba7261661475811c22b21b80ec765a71Timo Sirainen (*save_init)(struct mailbox_transaction_context *t,
a423d985ba7261661475811c22b21b80ec765a71Timo Sirainen const char *from_envelope, struct istream *input,
a423d985ba7261661475811c22b21b80ec765a71Timo Sirainen int (*save_continue)(struct mail_save_context *ctx);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen int (*save_finish)(struct mail_save_context *ctx,
a423d985ba7261661475811c22b21b80ec765a71Timo Sirainen void (*save_cancel)(struct mail_save_context *ctx);
345212e8f61ebf14ff4f80df26df9e655eb5121eTimo Sirainen int (*copy)(struct mailbox_transaction_context *t, struct mail *mail,
c13f3df87bc8ec1fb279fc0ffa6e8517f74dc07cTimo Sirainen enum mail_flags flags, struct mail_keywords *keywords,
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen/* private: */
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen /* Module-specific contexts. See mail_storage_module_id. */
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen int (*set_seq)(struct mail *mail, uint32_t seq);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen enum mail_flags (*get_flags)(struct mail *mail);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen const char *const *(*get_keywords)(struct mail *mail);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen const struct message_part *(*get_parts)(struct mail *mail);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen time_t (*get_received_date)(struct mail *mail);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen time_t (*get_date)(struct mail *mail, int *timezone);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen uoff_t (*get_virtual_size)(struct mail *mail);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen uoff_t (*get_physical_size)(struct mail *mail);
87460b08cb97b31cde640d4975a6aa2c1d0e7226Timo Sirainen const char *(*get_first_header)(struct mail *mail, const char *field);
87460b08cb97b31cde640d4975a6aa2c1d0e7226Timo Sirainen const char *const *(*get_headers)(struct mail *mail, const char *field);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen struct istream *(*get_stream)(struct mail *mail,
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen int (*update_flags)(struct mail *mail, enum modify_type modify_type,
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen int (*update_keywords)(struct mail *mail, enum modify_type modify_type,
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen struct mailbox_transaction_context *transaction;
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen struct mailbox_transaction_context *transaction;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen/* Set error message in storage. Critical errors are logged with i_error(),
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen but user sees only "internal error" message. */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenvoid mail_storage_clear_error(struct mail_storage *storage);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenvoid mail_storage_set_error(struct mail_storage *storage,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenvoid mail_storage_set_syntax_error(struct mail_storage *storage,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenvoid mail_storage_set_critical(struct mail_storage *storage,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenvoid mail_storage_set_internal_error(struct mail_storage *storage);