From 77dc80bbbe942eef0453fc1e3b7782a2ddf29879 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Mon, 13 Apr 2020 13:13:37 -0400 Subject: Preserve original Date header in envelope --- parse.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index 8d3205d..ff97789 100644 --- a/parse.c +++ b/parse.c @@ -66,20 +66,22 @@ void parseEnvelope(struct Envelope *envelope, struct List list) { errx(EX_PROTOCOL, "missing envelope structure fields"); } - struct tm tm; + + struct tm time; const char *date = dataCheck(list.ptr[Date], String).string; + envelope->date = date; if (isalpha(date[0])) { - date = strptime(date, "%a, %e %b %Y %H:%M:%S ", &tm); + date = strptime(date, "%a, %e %b %Y %H:%M:%S ", &time); } else { - date = strptime(date, "%e %b %Y %H:%M:%S ", &tm); + date = strptime(date, "%e %b %Y %H:%M:%S ", &time); } if (date && (date[0] == '+' || date[0] == '-')) { - date = strptime(date, "%z", &tm); + date = strptime(date, "%z", &time); } else if (date) { - date = strptime(date, "%Z", &tm); + date = strptime(date, "%Z", &time); } if (!date) errx(EX_PROTOCOL, "invalid envelope date format"); - envelope->date = mktime(&tm); + envelope->time = mktime(&time); // TODO: Decode UTF-8 in subject. envelope->subject = strdup(dataCheck(list.ptr[Subject], String).string); -- cgit 1.4.1