mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 21:34:38 +03:00
implement imap savedate extension, rfc 8514
it makes a new field available on stored messages. not when they they were received (over smtp) or appended to the mailbox (over imap), but when they were last "saved" in the mailbox. copy/move of a message (eg to the trash) resets the "savedate" value. this helps implement "remove messages from trash after X days".
This commit is contained in:
@ -8,6 +8,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
@ -381,6 +382,7 @@ func (x XOps) MessageMoveTx(ctx context.Context, log mlog.Log, acc *store.Accoun
|
||||
var mbSrc store.Mailbox
|
||||
|
||||
keywords := map[string]struct{}{}
|
||||
now := time.Now()
|
||||
|
||||
for _, mid := range messageIDs {
|
||||
m := x.messageID(ctx, tx, mid)
|
||||
@ -436,6 +438,7 @@ func (x XOps) MessageMoveTx(ctx context.Context, log mlog.Log, acc *store.Accoun
|
||||
m.ModSeq = modseq
|
||||
mbDst.UIDNext++
|
||||
m.JunkFlagsForMailbox(mbDst, conf)
|
||||
m.SaveDate = &now
|
||||
err = tx.Update(&m)
|
||||
x.Checkf(ctx, err, "updating moved message in database")
|
||||
|
||||
|
Reference in New Issue
Block a user