struct imapc_mailbox *mbox)
{
struct mail_index_view *view = mbox->delayed_sync_view;
+ uint32_t rcount = reply->num;
const struct mail_index_header *hdr;
if (mbox == NULL)
msg_count = imapc_msgmap_count(msgmap);
if (rseq > msg_count) {
/* newly seen message */
- if (!mbox->syncing || fetch_uid == 0 || rseq != msg_count+1)
+ if (fetch_uid == 0 || rseq != msg_count+1) {
+ /* can't handle this one now. we should get another
+ FETCH reply for it. */
return;
+ }
uid = fetch_uid;
if (uid < imapc_msgmap_uidnext(msgmap)) {
if (uid < mbox->min_append_uid) {
/* message is already added to index */
lseq = 0;
- } else {
+ } else if (mbox->syncing) {
mail_index_append(mbox->delayed_sync_trans, uid, &lseq);
mbox->min_append_uid = uid + 1;
}
}
lseq = 0;
}
+ /* if this is a reply to some FETCH request, update the mail's fields */
+ array_foreach(&mbox->fetch_mails, mailp) {
+ struct imapc_mail *mail = *mailp;
+
+ if (mail->imail.mail.mail.uid == uid)
+ imapc_mail_fetch_update(mail, reply, list);
+ }
+
if (lseq == 0) {
if (!mail_index_lookup_seq(mbox->delayed_sync_view,
uid, &lseq)) {
rec = mail_index_lookup(mbox->delayed_sync_view, lseq);
}
- /* if this is a reply to some FETCH request, update the mail's fields */
- array_foreach(&mbox->fetch_mails, mailp) {
- struct imapc_mail *mail = *mailp;
-
- if (mail->imail.mail.mail.uid == uid)
- imapc_mail_fetch_update(mail, reply, list);
- }
-
if (rseq == mbox->sync_next_rseq) {
/* we're doing the initial full sync of mails. expunge any
mails that no longer exist. */
mbox->sync_next_rseq++;
mbox->sync_next_lseq++;
}
+
if (seen_flags && (rec == NULL || rec->flags != flags)) {
mail_index_update_flags(mbox->delayed_sync_trans, lseq,
MODIFY_REPLACE, flags);