changeset 10539:0462fcfb809a HEAD

pop3: Added %g = GUID to pop3_uidl_format.
author Timo Sirainen <tss@iki.fi>
date Tue, 29 Dec 2009 18:32:13 -0500
parents 6f67d3ce4ac4
children d6d1df7ea4e0
files doc/example-config/conf.d/pop3.conf src/lib-storage/mail-storage-settings.c src/pop3/pop3-client.c src/pop3/pop3-commands.c src/pop3/pop3-common.h
diffstat 5 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/doc/example-config/conf.d/pop3.conf	Wed Dec 23 17:35:20 2009 -0500
+++ b/doc/example-config/conf.d/pop3.conf	Tue Dec 29 18:32:13 2009 -0500
@@ -27,6 +27,7 @@
   #  %u - Mail's IMAP UID
   #  %m - MD5 sum of the mailbox headers in hex (mbox only)
   #  %f - filename (maildir only)
+  #  %g - Mail's GUID
   #
   # If you want UIDL compatibility with other POP3 servers, use:
   #  UW's ipop3d         : %08Xv%08Xu
--- a/src/lib-storage/mail-storage-settings.c	Wed Dec 23 17:35:20 2009 -0500
+++ b/src/lib-storage/mail-storage-settings.c	Tue Dec 29 18:32:13 2009 -0500
@@ -311,6 +311,7 @@
 		case 'u':
 		case 'm':
 		case 'f':
+		case 'g':
 			uidl_format_ok = TRUE;
 			break;
 		case '%':
--- a/src/pop3/pop3-client.c	Wed Dec 23 17:35:20 2009 -0500
+++ b/src/pop3/pop3-client.c	Tue Dec 29 18:32:13 2009 -0500
@@ -178,6 +178,9 @@
 			case 'f':
 				mask |= UIDL_FILE_NAME;
 				break;
+			case 'g':
+				mask |= UIDL_GUID;
+				break;
 			}
 		}
 	}
--- a/src/pop3/pop3-commands.c	Wed Dec 23 17:35:20 2009 -0500
+++ b/src/pop3/pop3-commands.c	Tue Dec 29 18:32:13 2009 -0500
@@ -560,6 +560,14 @@
 			i_fatal("UIDL: File name not found");
 		}
 	}
+	if ((client->uidl_keymask & UIDL_GUID) != 0) {
+		if (mail_get_special(ctx->mail, MAIL_FETCH_GUID,
+				     &tab[4].value) < 0 ||
+		    *tab[4].value == '\0') {
+			/* broken */
+			i_fatal("UIDL: Message GUID not found");
+		}
+	}
 	var_expand(str, client->mail_set->pop3_uidl_format, tab);
 	return FALSE;
 }
@@ -571,6 +579,7 @@
 		{ 'u', NULL, "uid" },
 		{ 'm', NULL, "md5" },
 		{ 'f', NULL, "filename" },
+		{ 'g', NULL, "guid" },
 		{ '\0', NULL, NULL }
 	};
 	struct var_expand_table *tab;
--- a/src/pop3/pop3-common.h	Wed Dec 23 17:35:20 2009 -0500
+++ b/src/pop3/pop3-common.h	Tue Dec 29 18:32:13 2009 -0500
@@ -5,7 +5,8 @@
 	UIDL_UIDVALIDITY	= 0x01,
 	UIDL_UID		= 0x02,
 	UIDL_MD5		= 0x04,
-	UIDL_FILE_NAME		= 0x08
+	UIDL_FILE_NAME		= 0x08,
+	UIDL_GUID		= 0x10
 };
 
 #include "lib.h"