From: Timo Sirainen Date: Tue, 29 Dec 2009 23:32:13 +0000 (-0500) Subject: pop3: Added %g = GUID to pop3_uidl_format. X-Git-Tag: 2.0.beta2~80 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=66d420d694b63007b33df63261d4699018421455;p=thirdparty%2Fdovecot%2Fcore.git pop3: Added %g = GUID to pop3_uidl_format. --HG-- branch : HEAD --- diff --git a/doc/example-config/conf.d/pop3.conf b/doc/example-config/conf.d/pop3.conf index f422db20a9..a3d6816f0f 100644 --- a/doc/example-config/conf.d/pop3.conf +++ b/doc/example-config/conf.d/pop3.conf @@ -27,6 +27,7 @@ protocol pop3 { # %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 diff --git a/src/lib-storage/mail-storage-settings.c b/src/lib-storage/mail-storage-settings.c index 145af84a51..3f5b50066e 100644 --- a/src/lib-storage/mail-storage-settings.c +++ b/src/lib-storage/mail-storage-settings.c @@ -311,6 +311,7 @@ static bool mail_storage_settings_check(void *_set, pool_t pool ATTR_UNUSED, case 'u': case 'm': case 'f': + case 'g': uidl_format_ok = TRUE; break; case '%': diff --git a/src/pop3/pop3-client.c b/src/pop3/pop3-client.c index ecbc3eaa21..067d7cda19 100644 --- a/src/pop3/pop3-client.c +++ b/src/pop3/pop3-client.c @@ -178,6 +178,9 @@ static enum uidl_keys parse_uidl_keymask(const char *format) case 'f': mask |= UIDL_FILE_NAME; break; + case 'g': + mask |= UIDL_GUID; + break; } } } diff --git a/src/pop3/pop3-commands.c b/src/pop3/pop3-commands.c index 056af71cb6..617baf006a 100644 --- a/src/pop3/pop3-commands.c +++ b/src/pop3/pop3-commands.c @@ -560,6 +560,14 @@ static bool pop3_get_uid(struct client *client, struct cmd_uidl_context *ctx, 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 @@ static bool list_uids_iter(struct client *client, struct cmd_uidl_context *ctx) { 'u', NULL, "uid" }, { 'm', NULL, "md5" }, { 'f', NULL, "filename" }, + { 'g', NULL, "guid" }, { '\0', NULL, NULL } }; struct var_expand_table *tab; diff --git a/src/pop3/pop3-common.h b/src/pop3/pop3-common.h index ea16b5eb59..c201b83e2a 100644 --- a/src/pop3/pop3-common.h +++ b/src/pop3/pop3-common.h @@ -5,7 +5,8 @@ enum uidl_keys { UIDL_UIDVALIDITY = 0x01, UIDL_UID = 0x02, UIDL_MD5 = 0x04, - UIDL_FILE_NAME = 0x08 + UIDL_FILE_NAME = 0x08, + UIDL_GUID = 0x10 }; #include "lib.h"