]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Maildir: Moved uidlist refreshing to maildir_uidlist_lookup() where it
authorTimo Sirainen <tss@iki.fi>
Sun, 25 May 2008 02:01:47 +0000 (05:01 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 25 May 2008 02:01:47 +0000 (05:01 +0300)
benefits all callers.

--HG--
branch : HEAD

src/lib-storage/index/maildir/maildir-mail.c
src/lib-storage/index/maildir/maildir-uidlist.c

index 288b3ce3dc2dc7de06fc13169ced7b7e143d49a8..e456ffd31e16a4ae7726ccb0b16e48550a1be33c 100644 (file)
@@ -152,14 +152,6 @@ maildir_mail_get_fname(struct maildir_mailbox *mbox, struct mail *mail,
        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);
 
index 1e31e7ae3d626a3aac3b8bf61631085c0a8c9261..0b8364d87b6390a3778622ccbc67ffcdeee805d7 100644 (file)
@@ -821,12 +821,16 @@ maildir_uidlist_lookup(struct maildir_uidlist *uidlist, uint32_t uid,
 
        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);