dsync preserves uids, so uid==0 check won't work for detecting such mails.
--HG--
branch : HEAD
_ctx->dest_mail = ctx->mail;
}
mail_set_seq(_ctx->dest_mail, ctx->seq);
+ _ctx->dest_mail->saving = TRUE;
crlf_input = i_stream_create_crlf(input);
ctx->input = index_mail_cache_parse_init(_ctx->dest_mail, crlf_input);
_ctx->dest_mail = ctx->mail;
}
mail_set_seq(_ctx->dest_mail, ctx->seq);
+ _ctx->dest_mail->saving = TRUE;
crlf_input = i_stream_create_lf(input);
ctx->input = index_mail_cache_parse_init(_ctx->dest_mail, crlf_input);
do {
if (mail->open_file != NULL) {
/* already open */
- } else if (_mail->uid != 0) {
+ } else if (!_mail->saving) {
if (mdbox_mail_lookup(mbox, _mail->transaction->view,
_mail->seq, &map_uid) < 0)
return -1;
save_mail = array_append_space(&ctx->mails);
save_mail->seq = ctx->ctx.seq;
- if (_ctx->dest_mail != NULL)
+ if (_ctx->dest_mail != NULL) {
mail_set_seq(_ctx->dest_mail, ctx->ctx.seq);
+ _ctx->dest_mail->saving = TRUE;
+ }
return 0;
}
dbox_save_add_to_index(ctx);
sdbox_save_add_file(_ctx, dest_file);
- if (_ctx->dest_mail != NULL)
+ if (_ctx->dest_mail != NULL) {
mail_set_seq(_ctx->dest_mail, ctx->seq);
+ _ctx->dest_mail->saving = TRUE;
+ }
return 1;
}
if (mail->open_file != NULL) {
/* already set */
return FALSE;
- } else if (_mail->uid != 0) {
+ } else if (!_mail->saving) {
mail->open_file = sdbox_file_init(mbox, _mail->uid);
return FALSE;
} else {
mail->mail.mail.expunged = FALSE;
mail->mail.mail.has_nuls = FALSE;
mail->mail.mail.has_no_nuls = FALSE;
+ mail->mail.mail.saving = FALSE;
}
static void check_envelope(struct index_mail *mail)
ctx.path = NULL;
p->stats_open_lookup_count++;
- if (mail->uid != 0) {
+ if (!mail->saving) {
if (maildir_file_do(mbox, mail->uid, do_open, &ctx) < 0)
return NULL;
} else {
_ctx->dest_mail = ctx->mail;
}
mail_set_seq(_ctx->dest_mail, ctx->seq);
+ _ctx->dest_mail->saving = TRUE;
if (ctx->input == NULL) {
/* FIXME: copying with hardlinking. we could copy the
_ctx->dest_mail = ctx->mail;
}
mail_set_seq(_ctx->dest_mail, ctx->seq);
+ _ctx->dest_mail->saving = TRUE;
}
mbox_save_append_flag_headers(ctx->headers, save_flags);
mbox_save_append_keyword_headers(ctx, _ctx->keywords);
uint32_t seq, uid;
unsigned int expunged:1;
+ unsigned int saving:1; /* This mail is still being saved */
unsigned int has_nuls:1; /* message data is known to contain NULs */
unsigned int has_no_nuls:1; /* -''- known to not contain NULs */