mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 17:04:39 +03:00
implement the WITHIN IMAP extension, rfc 5032
for IMAP "SEARCH" command criteria "YOUNGER" and "OLDER".
This commit is contained in:
@ -5,6 +5,7 @@ import (
|
||||
"log/slog"
|
||||
"net/textproto"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mjl-/bstore"
|
||||
|
||||
@ -539,6 +540,13 @@ func (s *search) match0(sk searchKey) bool {
|
||||
// mailboxes, but we only have this metadata from the time we implemented this
|
||||
// feature.
|
||||
return s.m.SaveDate != nil
|
||||
case "OLDER":
|
||||
// ../rfc/5032:76
|
||||
seconds := int64(time.Since(s.m.Received) / time.Second)
|
||||
return seconds >= sk.number
|
||||
case "YOUNGER":
|
||||
seconds := int64(time.Since(s.m.Received) / time.Second)
|
||||
return seconds <= sk.number
|
||||
}
|
||||
|
||||
if s.p == nil {
|
||||
|
Reference in New Issue
Block a user