dovecot-2.2: doveadm fetch: Added date.sent/received/saved.unixtime

dovecot at dovecot.org dovecot at dovecot.org
Mon Nov 30 10:22:34 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/9a15b989cc41
changeset: 19434:9a15b989cc41
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Nov 30 12:22:22 2015 +0200
description:
doveadm fetch: Added date.sent/received/saved.unixtime

diffstat:

 src/doveadm/doveadm-mail-fetch.c |  35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diffs (52 lines):

diff -r 922de4bc4777 -r 9a15b989cc41 src/doveadm/doveadm-mail-fetch.c
--- a/src/doveadm/doveadm-mail-fetch.c	Sat Nov 28 23:50:14 2015 +0200
+++ b/src/doveadm/doveadm-mail-fetch.c	Mon Nov 30 12:22:22 2015 +0200
@@ -327,6 +327,38 @@
 	return 0;
 }
 
+static int fetch_date_received_unixtime(struct fetch_cmd_context *ctx)
+{
+	time_t t;
+
+	if (mail_get_received_date(ctx->mail, &t) < 0)
+		return -1;
+	doveadm_print(dec2str(t));
+	return 0;
+}
+
+static int fetch_date_sent_unixtime(struct fetch_cmd_context *ctx)
+{
+	time_t t;
+	int tz;
+
+	if (mail_get_date(ctx->mail, &t, &tz) < 0)
+		return -1;
+
+	doveadm_print(dec2str(t));
+	return 0;
+}
+
+static int fetch_date_saved_unixtime(struct fetch_cmd_context *ctx)
+{
+	time_t t;
+
+	if (mail_get_save_date(ctx->mail, &t) < 0)
+		return -1;
+	doveadm_print(dec2str(t));
+	return 0;
+}
+
 static int fetch_imap_envelope(struct fetch_cmd_context *ctx)
 {
 	const char *value;
@@ -417,6 +449,9 @@
 	{ "date.received", MAIL_FETCH_RECEIVED_DATE, fetch_date_received },
 	{ "date.sent",     MAIL_FETCH_DATE,          fetch_date_sent },
 	{ "date.saved",    MAIL_FETCH_SAVE_DATE,     fetch_date_saved },
+	{ "date.received.unixtime", MAIL_FETCH_RECEIVED_DATE, fetch_date_received_unixtime },
+	{ "date.sent.unixtime",     MAIL_FETCH_DATE,          fetch_date_sent_unixtime },
+	{ "date.saved.unixtime",    MAIL_FETCH_SAVE_DATE,     fetch_date_saved_unixtime },
 	{ "imap.envelope", MAIL_FETCH_IMAP_ENVELOPE, fetch_imap_envelope },
 	{ "imap.body",     MAIL_FETCH_IMAP_BODY,     fetch_imap_body },
 	{ "imap.bodystructure", MAIL_FETCH_IMAP_BODYSTRUCTURE, fetch_imap_bodystructure },


More information about the dovecot-cvs mailing list