Mercurial > dovecot > original-hg > dovecot-1.2
changeset 9069:aedec88c6e31 HEAD
Added FETCH X-SAVEDATE.
Based on patch by Alaa Ibrahim.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 20 May 2009 22:53:22 -0400 |
parents | 0fdffcb66945 |
children | b57a14e489b3 |
files | src/imap/imap-fetch.c |
diffstat | 1 files changed, 27 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/imap-fetch.c Wed May 20 17:50:57 2009 -0400 +++ b/src/imap/imap-fetch.c Wed May 20 22:53:22 2009 -0400 @@ -22,7 +22,7 @@ #define ENVELOPE_NIL_REPLY \ "(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL)" -#define IMAP_FETCH_HANDLER_COUNT 10 +#define IMAP_FETCH_HANDLER_COUNT 11 extern const struct imap_fetch_handler imap_fetch_default_handlers[IMAP_FETCH_HANDLER_COUNT]; static buffer_t *fetch_handlers = NULL; @@ -821,6 +821,30 @@ return TRUE; } +static int fetch_x_savedate(struct imap_fetch_context *ctx, struct mail *mail, + void *context ATTR_UNUSED) +{ + time_t date; + + if (mail_get_save_date(mail, &date) < 0) + return -1; + + str_printfa(ctx->cur_str, "X-SAVEDATE \"%s\" ", + imap_to_datetime(date)); + return 1; +} + +static bool +fetch_x_savedate_init(struct imap_fetch_context *ctx, const char *name, + const struct imap_arg **args ATTR_UNUSED) +{ + ctx->fetch_data |= MAIL_FETCH_SAVE_DATE; + imap_fetch_add_handler(ctx, TRUE, FALSE, name, + "\"01-Jan-1970 00:00:00 +0000\"", + fetch_x_savedate, NULL); + return TRUE; +} + const struct imap_fetch_handler imap_fetch_default_handlers[IMAP_FETCH_HANDLER_COUNT] = { { "BODY", fetch_body_init }, @@ -832,5 +856,6 @@ { "RFC822", fetch_rfc822_init }, { "UID", fetch_uid_init }, { "X-GUID", fetch_guid_init }, - { "X-MAILBOX", fetch_x_mailbox_init } + { "X-MAILBOX", fetch_x_mailbox_init }, + { "X-SAVEDATE", fetch_x_savedate_init } };