dovecot-1.1: Maildir: Moved uidlist refreshing to maildir_uidlis...

dovecot at dovecot.org dovecot at dovecot.org
Sun May 25 05:01:51 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/d920ec986c34
changeset: 7550:d920ec986c34
user:      Timo Sirainen <tss at iki.fi>
date:      Sun May 25 05:01:47 2008 +0300
description:
Maildir: Moved uidlist refreshing to maildir_uidlist_lookup() where it
benefits all callers.

diffstat:

2 files changed, 10 insertions(+), 14 deletions(-)
src/lib-storage/index/maildir/maildir-mail.c    |    8 --------
src/lib-storage/index/maildir/maildir-uidlist.c |   16 ++++++++++------

diffs (44 lines):

diff -r e54ca78ce35f -r d920ec986c34 src/lib-storage/index/maildir/maildir-mail.c
--- a/src/lib-storage/index/maildir/maildir-mail.c	Sun May 25 04:49:08 2008 +0300
+++ b/src/lib-storage/index/maildir/maildir-mail.c	Sun May 25 05:01:47 2008 +0300
@@ -148,14 +148,6 @@ maildir_mail_get_fname(struct maildir_ma
 	uint32_t seq;
 	bool exists;
 
-	*fname_r = maildir_uidlist_lookup(mbox->uidlist, mail->uid, &flags);
-	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;
diff -r e54ca78ce35f -r d920ec986c34 src/lib-storage/index/maildir/maildir-uidlist.c
--- a/src/lib-storage/index/maildir/maildir-uidlist.c	Sun May 25 04:49:08 2008 +0300
+++ b/src/lib-storage/index/maildir/maildir-uidlist.c	Sun May 25 05:01:47 2008 +0300
@@ -821,12 +821,16 @@ maildir_uidlist_lookup(struct maildir_ui
 
 	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);


More information about the dovecot-cvs mailing list