dovecot-2.1: lib-mail: message_date_parse() now also accepts '.'...

dovecot at dovecot.org dovecot at dovecot.org
Fri Mar 23 12:26:55 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/d4cc57c8a455
changeset: 14340:d4cc57c8a455
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Mar 23 12:26:50 2012 +0200
description:
lib-mail: message_date_parse() now also accepts '.' separator in hh.mm.ss time.

diffstat:

 src/lib-mail/message-date.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r f30437ed63dc -r d4cc57c8a455 src/lib-mail/message-date.c
--- a/src/lib-mail/message-date.c	Thu Mar 22 18:28:59 2012 +0200
+++ b/src/lib-mail/message-date.c	Fri Mar 23 12:26:50 2012 +0200
@@ -9,6 +9,11 @@
 
 #include <ctype.h>
 
+/* RFC specifies ':' as the only allowed separator,
+   but be forgiving also for some broken ones */
+#define IS_TIME_SEP(c) \
+	((c) == ':' || (c) == '.')
+
 struct message_date_parser_context {
 	struct rfc822_parser_context parser;
 	string_t *str;
@@ -189,7 +194,7 @@
 	}
 
 	/* :mm (may be the last token) */
-	if (*ctx->parser.data != ':')
+	if (!IS_TIME_SEP(*ctx->parser.data))
 		return FALSE;
 	ctx->parser.data++;
 	(void)rfc822_skip_lwsp(&ctx->parser);
@@ -200,7 +205,8 @@
 	tm.tm_min = (value[0]-'0') * 10 + (value[1]-'0');
 
 	/* [:ss] */
-	if (ctx->parser.data != ctx->parser.end && *ctx->parser.data == ':') {
+	if (ctx->parser.data != ctx->parser.end &&
+	    IS_TIME_SEP(*ctx->parser.data)) {
 		ctx->parser.data++;
 		(void)rfc822_skip_lwsp(&ctx->parser);
 


More information about the dovecot-cvs mailing list