mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 17:04:39 +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:
@ -65,6 +65,7 @@ func TestSearch(t *testing.T) {
|
||||
|
||||
// Add 5 and delete first 4 messages. So UIDs start at 5.
|
||||
received := time.Date(2020, time.January, 1, 10, 0, 0, 0, time.UTC)
|
||||
saveDate := time.Now()
|
||||
for i := 0; i < 5; i++ {
|
||||
tc.client.Append("inbox", nil, &received, []byte(exampleMsg))
|
||||
}
|
||||
@ -110,6 +111,20 @@ func TestSearch(t *testing.T) {
|
||||
tc.transactf("ok", "search before 1-Jan-2020")
|
||||
tc.xsearch() // Before is about received, not date header of message.
|
||||
|
||||
// SAVEDATE extension.
|
||||
tc.transactf("ok", "search savedbefore %s", saveDate.Add(24*time.Hour).Format("2-Jan-2006"))
|
||||
tc.xsearch(1, 2, 3)
|
||||
tc.transactf("ok", "search savedbefore %s", saveDate.Add(-24*time.Hour).Format("2-Jan-2006"))
|
||||
tc.xsearch()
|
||||
tc.transactf("ok", "search savedon %s", saveDate.Format("2-Jan-2006"))
|
||||
tc.xsearch(1, 2, 3)
|
||||
tc.transactf("ok", "search savedon %s", saveDate.Add(-24*time.Hour).Format("2-Jan-2006"))
|
||||
tc.xsearch()
|
||||
tc.transactf("ok", "search savedsince %s", saveDate.Add(-24*time.Hour).Format("2-Jan-2006"))
|
||||
tc.xsearch(1, 2, 3)
|
||||
tc.transactf("ok", "search savedsince %s", saveDate.Add(24*time.Hour).Format("2-Jan-2006"))
|
||||
tc.xsearch()
|
||||
|
||||
tc.transactf("ok", `search body "Joe"`)
|
||||
tc.xsearch(1)
|
||||
tc.transactf("ok", `search body "Joe" body "bogus"`)
|
||||
|
Reference in New Issue
Block a user