bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2007-2018 Dovecot authors, see the included COPYING file */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenstatic void sdbox_mail_set_expunged(struct dbox_mail *mail)
0a7b04ec6441fdcf083392888b2e30844fc3e86dTimo Sirainen if (mail_index_is_expunged(_mail->transaction->view, _mail->seq)) {
d4002fe1f64d25a792f76fb102ef7dc519cd4e24Martti Rannanjärvi mail_set_critical(_mail, "dbox: Unexpectedly lost uid");
0fcfa7698e7beb78019ac89a869eef1b41e56a62Timo Sirainenstatic int sdbox_mail_file_set(struct dbox_mail *mail)
df3963075d67f76ade66b6a74764f4eae31d9c87Josef 'Jeff' Sipek struct sdbox_mailbox *mbox = SDBOX_MAILBOX(_mail->box);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen /* already set */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen mail->open_file = sdbox_file_init(mbox, _mail->uid);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen /* mail is being saved in this transaction */
d665e2948cb6fe8016706752a9e4940d64f4a61dTimo Sirainen /* it doesn't have input stream yet */
4ca83616715c3bd417e34ced2c1d61852513e427Timo Sirainen ret = dbox_file_open(mail->open_file, &deleted);
d4002fe1f64d25a792f76fb102ef7dc519cd4e24Martti Rannanjärvi "dbox: Unexpectedly lost mail being saved");
03de962febfc2ac572f9e4029463c16d29c1ed55Timo Sirainensdbox_mail_get_special(struct mail *_mail, enum mail_fetch_field field,
03de962febfc2ac572f9e4029463c16d29c1ed55Timo Sirainen const char **value_r)
df3963075d67f76ade66b6a74764f4eae31d9c87Josef 'Jeff' Sipek struct sdbox_mailbox *mbox = SDBOX_MAILBOX(_mail->box);
804fa3f03bd9170272168a5ad214053bbe3160c7Josef 'Jeff' Sipek struct dbox_mail *mail = DBOX_MAIL(_mail);
03de962febfc2ac572f9e4029463c16d29c1ed55Timo Sirainen _mail->transaction->stats.fstat_lookup_count++;
03de962febfc2ac572f9e4029463c16d29c1ed55Timo Sirainen if (dbox_file_stat(mail->open_file, &st) < 0) {
03de962febfc2ac572f9e4029463c16d29c1ed55Timo Sirainen *value_r = p_strdup_printf(mail->imail.mail.data_pool, "%lu",
9865d9e7c5713e41db939222ed9c0225a11fb99eTimo Sirainen if (!dbox_header_have_flag(&mbox->box, mbox->hdr_ext_id,
9865d9e7c5713e41db939222ed9c0225a11fb99eTimo Sirainen if (!dbox_header_have_flag(&mbox->box, mbox->hdr_ext_id,
9865d9e7c5713e41db939222ed9c0225a11fb99eTimo Sirainen return dbox_mail_get_special(_mail, field, value_r);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint sdbox_mail_open(struct dbox_mail *mail, uoff_t *offset_r,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen if (_mail->lookup_abort != MAIL_LOOKUP_ABORT_NEVER) {
2d01cc1880cf2afd4fb1c8ad7fa6ce78e562e71eTimo Sirainen _mail->transaction->stats.open_lookup_count++;