bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
69a71891361b2b27ff68ed84b29278486628464aAki Tuomidsync_mail_get_hash_headers(struct mailbox *box, const char *const *hashed_headers)
f97c983e7a742e1d54ec60e502093abbb3ad2907Timo Sirainen return mailbox_header_lookup_init(box, hashed_headers);
45af47783693b3ba2768c5ad34eeff68132382d0Timo Sirainenint dsync_mail_get_hdr_hash(struct mail *mail, unsigned int version,
69a71891361b2b27ff68ed84b29278486628464aAki Tuomi const char *const *hashed_headers, const char **hdr_hash_r)
271ba0b2a103e8040021597a3922f27b40d5b5dcTimo Sirainen hdr_ctx = mailbox_header_lookup_init(mail->box, hashed_headers);
ccaaf1874bb0c569ca2589444717fde155e1becaTimo Sirainen ret = mail_get_header_stream(mail, hdr_ctx, &hdr_input);
7f74811b78f8915e73dffc88bb49009e98b6846dTimo Sirainen while ((sret = i_stream_read_more(input, &data, &size)) > 0) {
b75eba4f65c7630d3691f07d22ff4bdfcac5054dTimo Sirainen message_header_hash_more(&hash_ctx, &hash_method_md5, &md5_ctx,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen *hdr_hash_r = binary_to_hex(md5_result, sizeof(md5_result));
d519a0449d0e536a32db93305516fdbd7db6773dTimo Sirainenint dsync_mail_fill(struct mail *mail, bool minimal_fill,
d519a0449d0e536a32db93305516fdbd7db6773dTimo Sirainen struct dsync_mail *dmail_r, const char **error_field_r)
d9b9687bf8cae9cfb070b1b7aadefa683220269fTimo Sirainen if (mail_get_special(mail, MAIL_FETCH_GUID, &guid) < 0) {
d519a0449d0e536a32db93305516fdbd7db6773dTimo Sirainen if (mail_get_save_date(mail, &dmail_r->saved_date) < 0) {
d519a0449d0e536a32db93305516fdbd7db6773dTimo Sirainen return dsync_mail_fill_nonminimal(mail, dmail_r, error_field_r);
d519a0449d0e536a32db93305516fdbd7db6773dTimo Sirainenint dsync_mail_fill_nonminimal(struct mail *mail, struct dsync_mail *dmail_r,
d9b9687bf8cae9cfb070b1b7aadefa683220269fTimo Sirainen if (mail_get_stream(mail, NULL, NULL, &dmail_r->input) < 0) {
d9b9687bf8cae9cfb070b1b7aadefa683220269fTimo Sirainen if (mail_get_special(mail, MAIL_FETCH_UIDL_BACKEND, &dmail_r->pop3_uidl) < 0) {
d9b9687bf8cae9cfb070b1b7aadefa683220269fTimo Sirainen if (mail_get_special(mail, MAIL_FETCH_POP3_ORDER, &str) < 0) {
d9b9687bf8cae9cfb070b1b7aadefa683220269fTimo Sirainen if (str_to_uint(str, &dmail_r->pop3_order) < 0)
d9b9687bf8cae9cfb070b1b7aadefa683220269fTimo Sirainen if (mail_get_received_date(mail, &dmail_r->received_date) < 0) {
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenconst_string_array_dup(pool_t pool, const ARRAY_TYPE(const_string) *src,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen for (i = 0; i < count; i++) {
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenvoid dsync_mail_change_dup(pool_t pool, const struct dsync_mail_change *src,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen dest_r->hdr_hash = p_strdup(pool, src->hdr_hash);
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen const_string_array_dup(pool, &src->keyword_changes,