Enable THREAD=ORDEREDSUBJECT and SORT extensions for go-imap-sql

Closes #252.
This commit is contained in:
fox.cpp 2020-07-27 16:43:53 +03:00
parent c2f309f51b
commit 665c443de6
No known key found for this signature in database
GPG key ID: 5B991F6215D2FCC0
4 changed files with 42 additions and 2 deletions

View file

@ -31,6 +31,7 @@ import (
compress "github.com/emersion/go-imap-compress"
idle "github.com/emersion/go-imap-idle"
move "github.com/emersion/go-imap-move"
sortthread "github.com/emersion/go-imap-sortthread"
specialuse "github.com/emersion/go-imap-specialuse"
unselect "github.com/emersion/go-imap-unselect"
imapbackend "github.com/emersion/go-imap/backend"
@ -267,6 +268,11 @@ func (endp *Endpoint) enableExtensions() error {
endp.serv.Enable(specialuse.NewExtension())
case "I18NLEVEL=1", "I18NLEVEL=2":
endp.serv.Enable(i18nlevel.NewExtension())
case "SORT":
endp.serv.Enable(sortthread.NewSortExtension())
}
if strings.HasPrefix(ext, "THREAD") {
endp.serv.Enable(sortthread.NewThreadExtension())
}
}
@ -278,6 +284,15 @@ func (endp *Endpoint) enableExtensions() error {
return nil
}
func (endp *Endpoint) SupportedThreadAlgorithms() []sortthread.ThreadAlgorithm {
be, ok := endp.Store.(sortthread.ThreadBackend)
if !ok {
return nil
}
return be.SupportedThreadAlgorithms()
}
func init() {
module.RegisterEndpoint("imap", New)