From: Timo Sirainen Date: Thu, 18 Dec 2008 17:34:35 +0000 (+0200) Subject: Maildir: If POP3 UIDL field is empty in dovecot-uidlist, use base filename as UIDL. X-Git-Tag: 1.2.beta1~176 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=89fb98e9eb7e95255a579c8e9d865383c2334a74;p=thirdparty%2Fdovecot%2Fcore.git Maildir: If POP3 UIDL field is empty in dovecot-uidlist, use base filename as UIDL. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/maildir/maildir-mail.c b/src/lib-storage/index/maildir/maildir-mail.c index c6449bbc20..0143a79f0a 100644 --- a/src/lib-storage/index/maildir/maildir-mail.c +++ b/src/lib-storage/index/maildir/maildir-mail.c @@ -434,7 +434,16 @@ maildir_mail_get_special(struct mail *_mail, enum mail_fetch_field field, case MAIL_FETCH_UIDL_BACKEND: uidl = maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid, MAILDIR_UIDLIST_REC_EXT_POP3_UIDL); - *value_r = uidl != NULL ? uidl : ""; + if (uidl == NULL) { + /* use the default */ + *value_r = ""; + } else if (*uidl == '\0') { + /* special optimization case: use the base file name */ + return maildir_mail_get_special(_mail, + MAIL_FETCH_UIDL_FILE_NAME, value_r); + } else { + *value_r = uidl; + } return 0; default: return index_mail_get_special(_mail, field, value_r);