From: Timo Sirainen Date: Thu, 29 May 2008 15:57:56 +0000 (+0300) Subject: Maildir: If POP3 UIDL extra field is found from dovecot-uidlist, it's used X-Git-Tag: 1.1.rc6~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e76c494ad6535d3de314cc0d3ac7a44b06e53c4b;p=thirdparty%2Fdovecot%2Fcore.git Maildir: If POP3 UIDL extra field is found from dovecot-uidlist, it's used instead of the default UIDL format (or X-UIDL: header). Patch by Nicholas Von Hollen @ Mailtrust. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/maildir/maildir-mail.c b/src/lib-storage/index/maildir/maildir-mail.c index e456ffd31e..31ba4aed5f 100644 --- a/src/lib-storage/index/maildir/maildir-mail.c +++ b/src/lib-storage/index/maildir/maildir-mail.c @@ -412,7 +412,7 @@ maildir_mail_get_special(struct mail *_mail, enum mail_fetch_field field, { struct index_mail *mail = (struct index_mail *)_mail; struct maildir_mailbox *mbox = (struct maildir_mailbox *)mail->ibox; - const char *path, *fname, *end; + const char *path, *fname, *end, *uidl; if (field == MAIL_FETCH_UIDL_FILE_NAME) { if (_mail->uid != 0) { @@ -427,6 +427,15 @@ maildir_mail_get_special(struct mail *_mail, enum mail_fetch_field field, end = strchr(fname, MAILDIR_INFO_SEP); *value_r = end == NULL ? fname : t_strdup_until(fname, end); return 0; + } else if (field == MAIL_FETCH_UIDL_BACKEND) { + uidl = maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid, + MAILDIR_UIDLIST_REC_EXT_POP3_UIDL); + if (uidl != NULL) { + *value_r = uidl; + return 0; + } else { + return -1; + } } return index_mail_get_special(_mail, field, value_r); diff --git a/src/lib-storage/mail-storage.h b/src/lib-storage/mail-storage.h index fe0455db4a..3508b1aab2 100644 --- a/src/lib-storage/mail-storage.h +++ b/src/lib-storage/mail-storage.h @@ -107,7 +107,8 @@ enum mail_fetch_field { MAIL_FETCH_IMAP_ENVELOPE = 0x00004000, MAIL_FETCH_FROM_ENVELOPE = 0x00008000, MAIL_FETCH_HEADER_MD5 = 0x00010000, - MAIL_FETCH_UIDL_FILE_NAME = 0x00020000 + MAIL_FETCH_UIDL_FILE_NAME = 0x00020000, + MAIL_FETCH_UIDL_BACKEND = 0x00040000 }; enum mailbox_transaction_flags { diff --git a/src/pop3/commands.c b/src/pop3/commands.c index f9a9e930b7..d74a70c011 100644 --- a/src/pop3/commands.c +++ b/src/pop3/commands.c @@ -562,9 +562,12 @@ static bool list_uids_iter(struct client *client, struct cmd_uidl_context *ctx) str_truncate(str, 0); str_printfa(str, ctx->message == 0 ? "%u " : "+OK %u ", ctx->mail->seq); - - if (reuse_xuidl && - mail_get_first_header(ctx->mail, "X-UIDL", &uidl) > 0) + + if (mail_get_special(ctx->mail, MAIL_FETCH_UIDL_BACKEND, + &uidl) == 0) + str_append(str, uidl); + else if (reuse_xuidl && + mail_get_first_header(ctx->mail, "X-UIDL", &uidl) > 0) str_append(str, uidl); else var_expand(str, uidl_format, tab);