diff src/imap/cmd-append.c @ 492:efa46e28a0d7 HEAD

Fixes to timezone handling which were handling quite badly. added ioloop_timezone which gets updated with ioloop_time. Changed some GMT references to UTC. Timezone offsets are in minutes now everywhere instead of seconds. Fixes for unsigned time_t.
author Timo Sirainen <tss@iki.fi>
date Thu, 24 Oct 2002 03:15:38 +0300
parents 925d6eb5f8be
children e1254b838e0b
line wrap: on
line diff
--- a/src/imap/cmd-append.c	Thu Oct 24 00:07:37 2002 +0300
+++ b/src/imap/cmd-append.c	Thu Oct 24 03:15:38 2002 +0300
@@ -7,6 +7,8 @@
 #include "imap-parser.h"
 #include "imap-date.h"
 
+#include <sys/time.h>
+
 /* Returns -1 = error, 0 = need more data, 1 = successful. flags and
    internal_date may be NULL as a result, but mailbox and msg_size are always
    set when successful. */
@@ -78,7 +80,7 @@
 	const char *custom_flags[MAIL_CUSTOM_FLAGS_COUNT];
 	const char *mailbox, *internal_date_str;
 	uoff_t msg_size;
-	int failed;
+	int failed, timezone_offset;
 
 	/* <mailbox> [<flags>] [<internal date>] <message literal> */
 	switch (validate_args(client, &mailbox, &flags_list,
@@ -106,7 +108,9 @@
 	if (internal_date_str == NULL) {
 		/* no time given, default to now. */
 		internal_date = ioloop_time;
-	} else if (!imap_parse_datetime(internal_date_str, &internal_date)) {
+                timezone_offset = ioloop_timezone.tz_minuteswest;
+	} else if (!imap_parse_datetime(internal_date_str, &internal_date,
+					&timezone_offset)) {
 		client_send_tagline(client, "BAD Invalid internal date.");
 		return TRUE;
 	}
@@ -126,7 +130,8 @@
 	o_buffer_flush(client->outbuf);
 
 	/* save the mail */
-	failed = !box->save(box, flags, custom_flags, internal_date,
+	failed = !box->save(box, flags, custom_flags,
+			    internal_date, timezone_offset,
 			    client->inbuf, msg_size);
 	box->close(box);