unsigned flagged : 1;
unsigned replied : 1;
} flags;
+ time_t received; /* the time at which this message was received */
} MESSAGE;
CONTEXT *mx_open_mailbox (const char *, int, CONTEXT *);
#include <ctype.h>
#include <errno.h>
#include <string.h>
+#include <utime.h>
struct maildir
{
if (hdr)
mutt_str_replace (&hdr->path, path);
FREE (&msg->path);
+
+ /*
+ * Adjust the mtime on the file to match the time at which this
+ * message was received. Currently this is only set when copying
+ * messages between mailboxes, so we test to ensure that it is
+ * actually set.
+ */
+ if (msg->received)
+ {
+ struct utimbuf ut;
+
+ ut.actime = msg->received;
+ ut.modtime = msg->received;
+ if (utime (full, &ut))
+ {
+ mutt_perror (_("maildir_commit_message(): unable to set time on file"));
+ return -1;
+ }
+ }
+
return 0;
}
else if (errno != EEXIST)
MESSAGE *msg;
int (*func) (MESSAGE *, CONTEXT *, HEADER *);
ADDRESS *p = NULL;
- time_t t;
switch (dest->magic)
{
msg->flags.flagged = hdr->flagged;
msg->flags.replied = hdr->replied;
msg->flags.read = hdr->read;
+ msg->received = hdr->received;
}
+
+ if(msg->received == 0)
+ time(&msg->received);
if (func (msg, dest, hdr) == 0)
{
p = hdr->env->sender;
else
p = hdr->env->from;
-
- if (!hdr->received)
- hdr->received = time (NULL);
- t = hdr->received;
}
- else
- t = time (NULL);
- fprintf (msg->fp, "From %s %s", p ? p->mailbox : NONULL(Username), ctime (&t));
+ fprintf (msg->fp, "From %s %s", p ? p->mailbox : NONULL(Username), ctime (&msg->received));
}
}
else