dovecot-2.0: lib-storage: Human search date parser now supports ...

dovecot at dovecot.org dovecot at dovecot.org
Thu May 27 22:31:45 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/59322f74214b
changeset: 11396:59322f74214b
user:      Timo Sirainen <tss at iki.fi>
date:      Thu May 27 20:00:03 2010 +0100
description:
lib-storage: Human search date parser now supports UNIX timestamps.

diffstat:

 src/lib-storage/mail-search-register-human.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 07c9d1115029 -r 59322f74214b src/lib-storage/mail-search-register-human.c
--- a/src/lib-storage/mail-search-register-human.c	Thu May 27 19:59:39 2010 +0100
+++ b/src/lib-storage/mail-search-register-human.c	Thu May 27 20:00:03 2010 +0100
@@ -35,6 +35,7 @@
 	const char *value, *error;
 	struct tm tm;
 	unsigned int secs;
+	unsigned long unixtime;
 
 	sarg = mail_search_build_new(ctx, type);
 	if (mail_search_parse_string(ctx->parser, &value) < 0)
@@ -42,7 +43,8 @@
 
 	/* a) yyyy-mm-dd
 	   b) imap date
-	   c) interval (e.g. n days) */
+	   c) unix timestamp
+	   d) interval (e.g. n days) */
 	if (i_isdigit(value[0]) && i_isdigit(value[1]) &&
 	    i_isdigit(value[2]) && i_isdigit(value[3]) && value[4] == '-' &&
 	    i_isdigit(value[5]) && i_isdigit(value[6]) && value[7] == '-' &&
@@ -55,6 +57,8 @@
 		sarg->value.time = mktime(&tm);
 	} else if (imap_parse_date(value, &sarg->value.time)) {
 		/* imap date */
+	} else if (str_to_ulong(value, &unixtime) == 0) {
+		sarg->value.time = unixtime;
 	} else if (settings_get_time(value, &secs, &error) == 0) {
 		sarg->value.time = ioloop_time - secs;
 	} else {


More information about the dovecot-cvs mailing list