[Dovecot] 1.0-test58

Andrey Panin pazke at donpac.ru
Fri Dec 17 13:16:07 EET 2004


On 351, 12 16, 2004 at 03:58:16AM +0200, Timo Sirainen wrote:
>
- Added pop3_uidl_format setting. No need to patch sources anymore if 
> you don't want the default.

Attached small patch adds Courier 0.x UIDL compatibiliy code.

Please consider applying.

-- 
Andrey Panin		| Linux and UNIX system administrator
pazke at donpac.ru		| PGP key: wwwkeys.pgp.net
-------------- next part --------------
diff -urdpNX /usr/share/dontdiff -x debian dovecot-1.0-test58.vanilla/dovecot-example.conf dovecot-1.0-test58/dovecot-example.conf
--- dovecot-1.0-test58.vanilla/dovecot-example.conf	2004-12-15 23:04:08.000000000 +0300
+++ dovecot-1.0-test58/dovecot-example.conf	2004-12-17 13:53:48.000000000 +0300
@@ -450,10 +450,11 @@ protocol pop3 {
   #  %v - Mailbox UIDVALIDITY
   #  %u - Mail UID
   #  %m - MD5 sum of the mailbox headers in hex (mbox only)
+  #  %f - filename (maildir only)
   #
   # If you want UIDL compatibility with other POP3 servers, use:
   #  UW's ipop3d         : %08Xv%08Xu
-  #  Courier version 0   : (maildir filename, not supported)
+  #  Courier version 0   : %f
   #  Courier version 1   : %u
   #  Courier version 2   : %v-%u
   #  Cyrus (old)         : %u
diff -urdpNX /usr/share/dontdiff -x debian dovecot-1.0-test58.vanilla/src/lib-storage/index/index-mail.c dovecot-1.0-test58/src/lib-storage/index/index-mail.c
--- dovecot-1.0-test58.vanilla/src/lib-storage/index/index-mail.c	2004-12-15 22:57:00.000000000 +0300
+++ dovecot-1.0-test58/src/lib-storage/index/index-mail.c	2004-12-17 13:31:36.000000000 +0300
@@ -580,6 +580,7 @@ const char *index_mail_get_special(struc
 			index_mail_headers_get_envelope(mail);
 		return data->envelope;
 	case MAIL_FETCH_FROM_ENVELOPE:
+	case MAIL_FETCH_FILE_NAME:
 		return NULL;
 	case MAIL_FETCH_HEADER_MD5:
 		if (mail_index_lookup_ext(mail->trans->trans_view, data->seq,
diff -urdpNX /usr/share/dontdiff -x debian dovecot-1.0-test58.vanilla/src/lib-storage/index/maildir/maildir-mail.c dovecot-1.0-test58/src/lib-storage/index/maildir/maildir-mail.c
--- dovecot-1.0-test58.vanilla/src/lib-storage/index/maildir/maildir-mail.c	2004-08-28 14:23:35.000000000 +0400
+++ dovecot-1.0-test58/src/lib-storage/index/maildir/maildir-mail.c	2004-12-17 13:34:33.000000000 +0300
@@ -145,6 +145,19 @@ static uoff_t maildir_mail_get_virtual_s
 	return index_mail_get_virtual_size(_mail);
 }
 
+static const char *
+maildir_mail_get_special(struct mail *_mail, enum mail_fetch_field field)
+{
+	struct index_mail *mail = (struct index_mail *)_mail;
+	enum maildir_uidlist_rec_flag flags;
+
+	if (field == MAIL_FETCH_FILE_NAME)
+		return maildir_uidlist_lookup(mail->ibox->uidlist,
+					      mail->mail.uid, &flags);
+
+	return index_mail_get_special(_mail, field);
+}
+							
 static uoff_t maildir_mail_get_physical_size(struct mail *_mail)
 {
 	struct index_mail *mail = (struct index_mail *)_mail;
@@ -223,7 +236,7 @@ struct mail maildir_mail = {
 	index_mail_get_header,
 	index_mail_get_headers,
 	maildir_mail_get_stream,
-	index_mail_get_special,
+	maildir_mail_get_special,
 	index_mail_update_flags,
 	index_mail_expunge
 };
diff -urdpNX /usr/share/dontdiff -x debian dovecot-1.0-test58.vanilla/src/lib-storage/mail-storage.h dovecot-1.0-test58/src/lib-storage/mail-storage.h
--- dovecot-1.0-test58.vanilla/src/lib-storage/mail-storage.h	2004-12-15 22:54:45.000000000 +0300
+++ dovecot-1.0-test58/src/lib-storage/mail-storage.h	2004-12-17 13:17:04.000000000 +0300
@@ -83,7 +83,8 @@ enum mail_fetch_field {
 	MAIL_FETCH_IMAP_BODYSTRUCTURE	= 0x00002000,
 	MAIL_FETCH_IMAP_ENVELOPE	= 0x00004000,
 	MAIL_FETCH_FROM_ENVELOPE	= 0x00008000,
-	MAIL_FETCH_HEADER_MD5		= 0x00010000
+	MAIL_FETCH_HEADER_MD5		= 0x00010000,
+	MAIL_FETCH_FILE_NAME		= 0x00020000
 };
 
 enum mailbox_sync_flags {
diff -urdpNX /usr/share/dontdiff -x debian dovecot-1.0-test58.vanilla/src/pop3/commands.c dovecot-1.0-test58/src/pop3/commands.c
--- dovecot-1.0-test58.vanilla/src/pop3/commands.c	2004-12-15 22:50:26.000000000 +0300
+++ dovecot-1.0-test58/src/pop3/commands.c	2004-12-17 13:37:24.000000000 +0300
@@ -483,6 +483,7 @@ static int list_uids_iter(struct client 
 		{ 'v', NULL },
 		{ 'u', NULL },
 		{ 'm', NULL },
+		{ 'f', NULL },
 		{ '\0', NULL }
 	};
 	struct var_expand_table *tab;
@@ -512,6 +513,10 @@ static int list_uids_iter(struct client 
 			tab[2].value =
 				mail->get_special(mail, MAIL_FETCH_HEADER_MD5);
 		}
+		if ((uidl_keymask & UIDL_FILE_NAME) != 0) {
+			tab[3].value =
+				mail->get_special(mail, MAIL_FETCH_FILE_NAME);
+		}
 
 		str_truncate(str, 0);
 		str_printfa(str, ctx->message == 0 ? "%u " : "+OK %u ",
diff -urdpNX /usr/share/dontdiff -x debian dovecot-1.0-test58.vanilla/src/pop3/common.h dovecot-1.0-test58/src/pop3/common.h
--- dovecot-1.0-test58.vanilla/src/pop3/common.h	2004-12-15 22:37:45.000000000 +0300
+++ dovecot-1.0-test58/src/pop3/common.h	2004-12-17 13:35:59.000000000 +0300
@@ -12,7 +12,8 @@ enum client_workarounds {
 enum uidl_keys {
 	UIDL_UIDVALIDITY	= 0x01,
 	UIDL_UID		= 0x02,
-	UIDL_MD5		= 0x04
+	UIDL_MD5		= 0x04,
+	UIDL_FILE_NAME		= 0x08
 };
 
 extern struct ioloop *ioloop;
diff -urdpNX /usr/share/dontdiff -x debian dovecot-1.0-test58.vanilla/src/pop3/main.c dovecot-1.0-test58/src/pop3/main.c
--- dovecot-1.0-test58.vanilla/src/pop3/main.c	2004-12-15 22:52:30.000000000 +0300
+++ dovecot-1.0-test58/src/pop3/main.c	2004-12-17 13:35:38.000000000 +0300
@@ -87,6 +87,9 @@ static enum uidl_keys parse_uidl_keymask
 			case 'm':
 				mask |= UIDL_MD5;
 				break;
+			case 'f':
+				mask |= UIDL_FILE_NAME;
+				break;
 			}
 		}
 	}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://dovecot.org/pipermail/dovecot/attachments/20041217/e0069991/attachment-0001.bin>


More information about the dovecot mailing list