diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-10-15 14:30:40 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-10-15 14:41:39 +0300 |
commit | 5e5b68fd028495f7076a576df26962bbdf51ac63 (patch) | |
tree | f1298cce376344cbfc67de3e0b9baf8d7f459fd0 /libmailutils/base/date.c | |
parent | e759db27d650197ed1d8f837f30a2d03dcc23b4a (diff) | |
download | mailutils-5e5b68fd028495f7076a576df26962bbdf51ac63.tar.gz mailutils-5e5b68fd028495f7076a576df26962bbdf51ac63.tar.bz2 |
imap4d: fix returned INTERNALDATE and date searches.
INTERNALDATE now includes a meaningful timezone information (it
used to return +0000).
Date searches disregard the time and timezone of the INTERNALDATE
or Date: header, as mandated by RFC 3501.
* libmailutils/base/date.c (mu_parse_ctime_date_time): In the absence
of TZ in ctime strings, return local time zone.
* imap4d/io.c (imap4d_tokbuf_getline): Kill trailing whitespace.
* imap4d/util.c (adjust_tm): New function.
(util_parse_internal_date)
(util_parse_822_date)
(util_parse_ctime_date): Take three arguments, the third one controlling
what information to return. All uses updated.
* imap4d/fetch.c (_frt_internaldate): Return meaningful timezone.
If all else fails, use local TZ.
* imap4d/imap4d.h (datetime_parse_mode): New enum.
(util_parse_internal_date)
(util_parse_822_date)
(util_parse_ctime_date): Change signature.
* imap4d/search.c (parse_simple_key)
(_header_date,cond_before,cond_on,cond_since): Use datetime_date_only mode.
* testsuite/spool/search.mbox: New file.
* testsuite/spool/DISTFILES: Add search.mbox
* imap4d/testsuite/lib/imap4d.exp (imap4d_start): New option -mbox.
* imap4d/testsuite/imap4d/search.exp: Rewrite.
* imap4d/testsuite/imap4d/create.exp: Account for TZ part in internaldate
strings, which may vary.
* imap4d/testsuite/imap4d/fetch.exp: Likewise.
* imap4d/testsuite/imap4d/list.exp: List the new mailbox.
Diffstat (limited to 'libmailutils/base/date.c')
-rw-r--r-- | libmailutils/base/date.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libmailutils/base/date.c b/libmailutils/base/date.c index 1ca114091..e1e03fbf3 100644 --- a/libmailutils/base/date.c +++ b/libmailutils/base/date.c @@ -182,7 +182,7 @@ mu_parse_imap_date_time (const char **p, struct tm *tm, mu_timezone *tz) /* "ctime" format is: Thu Jul 01 15:58:27 1999, with no trailing \n. */ int -mu_parse_ctime_date_time (const char **p, struct tm *tm, mu_timezone * tz) +mu_parse_ctime_date_time (const char **p, struct tm *tm, mu_timezone *tz) { int wday = 0; int year = 0; @@ -236,9 +236,12 @@ mu_parse_ctime_date_time (const char **p, struct tm *tm, mu_timezone * tz) #endif } - /* ctime has no timezone information, set tz to UTC if they ask. */ + /* ctime has no timezone information, set tz to local TZ if they ask. */ if (tz) - memset (tz, 0, sizeof (struct mu_timezone)); - + { + tz->utc_offset = mu_utc_offset (); + tz->tz_name = NULL; + } + return 0; } |