diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-09-26 13:08:08 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-09-27 20:48:28 +0300 |
commit | 1d0c7b85b97343fd09f4076d069eeecc71f074a3 (patch) | |
tree | 1274531a16bf0989037762741df892f9297c5285 | |
parent | 90d867ead02af3280e83037a9899cbe36a21c58a (diff) | |
download | mailutils-1d0c7b85b97343fd09f4076d069eeecc71f074a3.tar.gz mailutils-1d0c7b85b97343fd09f4076d069eeecc71f074a3.tar.bz2 |
Assume UTC for IMAP internaldate
* include/mailutils/datetime.h (mu_datetime_tz_utc): New proto.
* libmailutils/datetime/tzutc.c: New file.
* libmailutils/datetime/Makefile.am: Add tzutc.c
* imap4d/fetch.c (_frt_internaldate): Assume UTC for internaldate.
* libproto/imap/fetch.c (_date_mapper): Likewise.
* mh/send.c: Improve diagnostics.
-rw-r--r-- | imap4d/fetch.c | 1 | ||||
-rw-r--r-- | include/mailutils/datetime.h | 1 | ||||
-rw-r--r-- | libmailutils/datetime/Makefile.am | 1 | ||||
-rw-r--r-- | libmailutils/datetime/tzutc.c | 11 | ||||
-rw-r--r-- | libproto/imap/fetch.c | 1 | ||||
-rw-r--r-- | mh/send.c | 2 |
6 files changed, 16 insertions, 1 deletions
diff --git a/imap4d/fetch.c b/imap4d/fetch.c index ef0c5604d..5efcda3a0 100644 --- a/imap4d/fetch.c +++ b/imap4d/fetch.c @@ -866,6 +866,7 @@ _frt_internaldate (struct fetch_function_closure *ffc, && mu_scan_datetime (date, MU_DATETIME_FROM, &tm, &tz, NULL) == 0) { tmp = &tm; + mu_datetime_tz_utc (&tz); } else { diff --git a/include/mailutils/datetime.h b/include/mailutils/datetime.h index ad8ba0793..a8a8234e2 100644 --- a/include/mailutils/datetime.h +++ b/include/mailutils/datetime.h @@ -83,6 +83,7 @@ int mu_parse_date (const char *p, time_t *rettime, const time_t *now); int mu_utc_offset (void); void mu_datetime_tz_local (struct mu_timezone *tz); +void mu_datetime_tz_utc (struct mu_timezone *tz); time_t mu_datetime_to_utc (struct tm *timeptr, struct mu_timezone *tz); size_t mu_strftime (char *s, size_t max, const char *format, struct tm *tm); diff --git a/libmailutils/datetime/Makefile.am b/libmailutils/datetime/Makefile.am index 66e51cf68..ba9d1bb9f 100644 --- a/libmailutils/datetime/Makefile.am +++ b/libmailutils/datetime/Makefile.am @@ -27,6 +27,7 @@ libdatetime_la_SOURCES = \ strftime.c\ tab.c\ tzlocal.c\ + tzutc.c\ unixtime.c\ utcoff.c\ yd.c diff --git a/libmailutils/datetime/tzutc.c b/libmailutils/datetime/tzutc.c new file mode 100644 index 000000000..e14b124f8 --- /dev/null +++ b/libmailutils/datetime/tzutc.c @@ -0,0 +1,11 @@ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif +#include <mailutils/datetime.h> + +void +mu_datetime_tz_utc (struct mu_timezone *tz) +{ + tz->utc_offset = 0; + tz->tz_name = "UTC"; +} diff --git a/libproto/imap/fetch.c b/libproto/imap/fetch.c index 360840466..74206f318 100644 --- a/libproto/imap/fetch.c +++ b/libproto/imap/fetch.c @@ -319,6 +319,7 @@ _date_mapper (union mu_imap_fetch_response *resp, if (mu_scan_datetime (elt->v.string, MU_DATETIME_INTERNALDATE, &tm, &tz, NULL)) return MU_ERR_FAILURE; + mu_datetime_tz_utc (&tz); resp->internaldate.tm = tm; resp->internaldate.tz = tz; return 0; @@ -362,7 +362,7 @@ open_mailer () status = mu_mailer_open (mailer, MU_STREAM_RDWR); if (status) { - mu_error (_("cannot open mailer `%s'"), url); + mu_error (_("cannot open mailer `%s': %s"), url, mu_strerror (status)); return NULL; } return mailer; |