if (*fname_r != NULL)
return TRUE;
- /* refresh uidlist and check again in case it was added after the last
- mailbox sync */
- if (maildir_uidlist_refresh(mbox->uidlist) < 0)
- return FALSE;
- *fname_r = maildir_uidlist_lookup(mbox->uidlist, mail->uid, &flags);
- if (*fname_r != NULL)
- return TRUE;
-
/* file exists in index file, but not in dovecot-uidlist anymore. */
mail_set_expunged(mail);
fname = maildir_uidlist_lookup_nosync(uidlist, uid, flags_r);
if (fname == NULL) {
- if (uidlist->fd != -1 || uidlist->mbox == NULL)
- return NULL;
-
- /* the uidlist doesn't exist. */
- if (maildir_storage_sync_force(uidlist->mbox, uid) < 0)
- return NULL;
+ if (uidlist->fd != -1 || uidlist->mbox == NULL) {
+ /* refresh uidlist and check again in case it was added
+ after the last mailbox sync */
+ if (maildir_uidlist_refresh(uidlist) < 0)
+ return NULL;
+ } else {
+ /* the uidlist doesn't exist. */
+ if (maildir_storage_sync_force(uidlist->mbox, uid) < 0)
+ return NULL;
+ }
/* try again */
fname = maildir_uidlist_lookup_nosync(uidlist, uid, flags_r);