Mercurial > dovecot > core-2.2
changeset 7570:2220b2aa9f7c HEAD
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.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 29 May 2008 18:57:56 +0300 |
parents | ea913434d522 |
children | 443dcddf9a9a |
files | src/lib-storage/index/maildir/maildir-mail.c src/lib-storage/mail-storage.h src/pop3/commands.c |
diffstat | 3 files changed, 18 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/maildir/maildir-mail.c Thu May 29 18:49:55 2008 +0300 +++ b/src/lib-storage/index/maildir/maildir-mail.c Thu May 29 18:57:56 2008 +0300 @@ -412,7 +412,7 @@ { 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 @@ 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);
--- a/src/lib-storage/mail-storage.h Thu May 29 18:49:55 2008 +0300 +++ b/src/lib-storage/mail-storage.h Thu May 29 18:57:56 2008 +0300 @@ -107,7 +107,8 @@ 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 {
--- a/src/pop3/commands.c Thu May 29 18:49:55 2008 +0300 +++ b/src/pop3/commands.c Thu May 29 18:57:56 2008 +0300 @@ -562,9 +562,12 @@ 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);