Skip to content

Commit

Permalink
append: always have an internaldate before checking if we should archive
Browse files Browse the repository at this point in the history
  • Loading branch information
brong committed Mar 18, 2016
1 parent 7787430 commit 38d9b7a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions imap/append.c
Expand Up @@ -929,6 +929,10 @@ EXPORTED int append_fromstage(struct appendstate *as, struct body **body,
r = message_create_record(&record, *body);
if (r) goto out;

/* And make sure it has a timestamp */
if (!record.internaldate)
record.internaldate = time(NULL);

/* should we archive it straight away? */
if (mailbox_should_archive(mailbox, &record, NULL))
record.system_flags |= FLAG_ARCHIVED;
Expand Down Expand Up @@ -970,8 +974,6 @@ EXPORTED int append_fromstage(struct appendstate *as, struct body **body,
#if defined ENABLE_OBJECTSTORE
if (object_storage_enabled && record.system_flags & FLAG_ARCHIVED)
{
if (!record.internaldate)
record.internaldate = time(NULL);
r = objectstore_put(mailbox, &record, fname);
if (!r) {
// file in object store now; must delete local copy
Expand Down

0 comments on commit 38d9b7a

Please sign in to comment.