aboutsummaryrefslogtreecommitdiffstats
path: root/worker/imap/worker.go
diff options
context:
space:
mode:
authorjp39 <jp39@gmx.com>2022-11-08 10:52:12 +0100
committerRobin Jarry <robin@jarry.cc>2022-11-09 21:21:12 +0100
commite0d279d6128a22db56326557883ad790544bc4f7 (patch)
tree5bf50a203762e4edf22d6f20ac0fe4d923d7b130 /worker/imap/worker.go
parentc84d91ad9f36c601a938fcbc0ebc29eb9a0e13fc (diff)
downloadaerc-e0d279d6128a22db56326557883ad790544bc4f7.tar.gz
imap: add support for ORDEREDSUBJECT threading algorithm
The imap worker incorrectly tries to use the REFERENCES threading algorithm by default although some servers only support the ORDEREDSUBJECT threading algorithm. Use whichever threading algorithm is advertised as supported by the server, buf prefer REFERENCES if available. Signed-off-by: jp39 <jp39@gmx.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'worker/imap/worker.go')
-rw-r--r--worker/imap/worker.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/worker/imap/worker.go b/worker/imap/worker.go
index c5032a0b..506eb182 100644
--- a/worker/imap/worker.go
+++ b/worker/imap/worker.go
@@ -70,6 +70,8 @@ type IMAPWorker struct {
cache *leveldb.DB
caps *models.Capabilities
+
+ threadAlgorithm sortthread.ThreadAlgorithm
}
func NewIMAPWorker(worker *types.Worker) (types.Backend, error) {
@@ -93,10 +95,14 @@ func (w *IMAPWorker) newClient(c *client.Client) {
w.caps.Sort = true
logging.Infof("Server Capability found: Sort")
}
- thread, err := w.client.thread.SupportThread()
- if err == nil && thread {
- w.caps.Thread = true
- logging.Infof("Server Capability found: Thread")
+ for _, alg := range []sortthread.ThreadAlgorithm{sortthread.References, sortthread.OrderedSubject} {
+ ok, err := w.client.Support(fmt.Sprintf("THREAD=%s", string(alg)))
+ if err == nil && ok {
+ w.threadAlgorithm = alg
+ w.caps.Thread = true
+ logging.Infof("Server Capability found: Thread (algorithm: %s)", string(alg))
+ break
+ }
}
}