about summary refs log tree commit diff
path: root/parse.c
diff options
context:
space:
mode:
authorC. McEnroe <june@causal.agency>2020-04-13 13:13:37 -0400
committerC. McEnroe <june@causal.agency>2020-04-13 13:13:37 -0400
commit77dc80bbbe942eef0453fc1e3b7782a2ddf29879 (patch)
tree5a1518ce9772429b13c08d6cd9d406c01224c39e /parse.c
parentUse UTC date everywhere (diff)
downloadbubger-77dc80bbbe942eef0453fc1e3b7782a2ddf29879.tar.gz
bubger-77dc80bbbe942eef0453fc1e3b7782a2ddf29879.zip
Preserve original Date header in envelope
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c14
1 files changed, 8 insertions, 6 deletions
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);