dovecot-1.1: Maildir: If POP3 UIDL extra field is found from dov...
dovecot at dovecot.org
dovecot at dovecot.org
Thu May 29 18:58:05 EEST 2008
details: http://hg.dovecot.org/dovecot-1.1/rev/2220b2aa9f7c
changeset: 7570:2220b2aa9f7c
user: Timo Sirainen <tss at iki.fi>
date: Thu May 29 18:57:56 2008 +0300
description:
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.
diffstat:
3 files changed, 18 insertions(+), 5 deletions(-)
src/lib-storage/index/maildir/maildir-mail.c | 11 ++++++++++-
src/lib-storage/mail-storage.h | 3 ++-
src/pop3/commands.c | 9 ++++++---
diffs (60 lines):
diff -r ea913434d522 -r 2220b2aa9f7c src/lib-storage/index/maildir/maildir-mail.c
--- 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 @@ maildir_mail_get_special(struct mail *_m
{
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 *_m
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 -r ea913434d522 -r 2220b2aa9f7c src/lib-storage/mail-storage.h
--- 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 @@ 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 -r ea913434d522 -r 2220b2aa9f7c src/pop3/commands.c
--- 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 @@ static bool list_uids_iter(struct client
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);
More information about the dovecot-cvs
mailing list