bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2007-2018 Dovecot authors, see the included COPYING file */
c6a57378d3c54988f525f81e19c0c5d132a0770dTimo Sirainenstatic const char *cydir_mail_get_path(struct mail *mail)
c6a57378d3c54988f525f81e19c0c5d132a0770dTimo Sirainen return t_strdup_printf("%s/%u.", dir, mail->uid);
c6a57378d3c54988f525f81e19c0c5d132a0770dTimo Sirainenstatic int cydir_mail_stat(struct mail *mail, struct stat *st_r)
35283613d4c04ce18836e9fc431582c87b3710a0Timo Sirainen if (mail->lookup_abort == MAIL_LOOKUP_ABORT_NOT_IN_CACHE) {
d4002fe1f64d25a792f76fb102ef7dc519cd4e24Martti Rannanjärvi mail_set_critical(mail, "stat(%s) failed: %m", path);
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainenstatic int cydir_mail_get_received_date(struct mail *_mail, time_t *date_r)
87490012895b4f371635ded00add04c9107dcfefJosef 'Jeff' Sipek struct index_mail *mail = INDEX_MAIL(_mail);
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainen if (index_mail_get_received_date(_mail, date_r) == 0)
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainenstatic int cydir_mail_get_save_date(struct mail *_mail, time_t *date_r)
87490012895b4f371635ded00add04c9107dcfefJosef 'Jeff' Sipek struct index_mail *mail = INDEX_MAIL(_mail);
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainen if (index_mail_get_save_date(_mail, date_r) == 0)
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainenstatic int cydir_mail_get_physical_size(struct mail *_mail, uoff_t *size_r)
87490012895b4f371635ded00add04c9107dcfefJosef 'Jeff' Sipek struct index_mail *mail = INDEX_MAIL(_mail);
ae1b268ffff743ad9927c304a1344c5cbd7f909dTimo Sirainen if (index_mail_get_physical_size(_mail, size_r) == 0)
75f3dddc3a5922c92a1bdb921b653ead51227cabTimo Sirainen data->physical_size = data->virtual_size = st.st_size;
6df0ab0c1ab91f06b6418cb30eff44405a1b8f02Timo Sirainencydir_mail_get_stream(struct mail *_mail, bool get_body ATTR_UNUSED,
87490012895b4f371635ded00add04c9107dcfefJosef 'Jeff' Sipek struct index_mail *mail = INDEX_MAIL(_mail);
2d01cc1880cf2afd4fb1c8ad7fa6ce78e562e71eTimo Sirainen _mail->transaction->stats.open_lookup_count++;
d4002fe1f64d25a792f76fb102ef7dc519cd4e24Martti Rannanjärvi mail_set_critical(_mail, "open(%s) failed: %m",
a4d796994ba01c207f1d3e373f58f06c6779af53Timo Sirainen index_mail_set_read_buffer_size(_mail, input);
a4d796994ba01c207f1d3e373f58f06c6779af53Timo Sirainen if (mail->mail.v.istream_opened(_mail, &input) < 0) {
83bb013a99f0936995f9c7a1077822662d8fefdbTimo Sirainen return index_mail_init_stream(mail, hdr_size, body_size, stream_r);
c6a57378d3c54988f525f81e19c0c5d132a0770dTimo Sirainen cydir_mail_get_physical_size, /* physical = virtual in our case */