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:
Mechiel Lukkien
2025-02-19 17:11:20 +01:00
parent cbe5bb235c
commit 7288e038e6
16 changed files with 136 additions and 10 deletions

View File

@ -424,8 +424,14 @@ type Message struct {
MailboxOrigID int64
MailboxDestinedID int64
// Received indicates time of receival over SMTP, or of IMAP APPEND.
Received time.Time `bstore:"default now,index"`
// SaveDate is the time of copy/move/save to a mailbox, used with IMAP SAVEDATE
// extension. Must be updated each time a message is copied/moved to another
// mailbox. Can be nil for messages from before this functionality was introduced.
SaveDate *time.Time `bstore:"default now"`
// Full IP address of remote SMTP server. Empty if not delivered over SMTP. The
// masked IPs are used to classify incoming messages. They are left empty for
// messages matching a ruleset for forwarded messages.