aboutsummaryrefslogtreecommitdiffstats
path: root/worker/imap/seqmap.go
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-08-16 12:25:48 -0500
committerRobin Jarry <robin@jarry.cc>2022-08-22 15:46:49 +0200
commita0a5ba1538d8b8108edbf737173cb0cee54caee5 (patch)
tree7b19559f8e4991af72359dbd5761c09d92ac7408 /worker/imap/seqmap.go
parentd7e6dc3649eadc27bdfdac77785b6bbf77d30b79 (diff)
downloadaerc-a0a5ba1538d8b8108edbf737173cb0cee54caee5.tar.gz
imap: create copy of uids to retain sort order
Commit fdfec2c07a8d seqmap: refactor seqmap to use slice instead of map introduced a regression to imap sorting (if supported). The slice passed to seqmap was being sorted in place by UID, thus breaking any sort order sent by the server. Create a copy of the slice to retain the sort order reported to the UI while also keeping a correct map for seqnum -> UID in the worker. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/imap/seqmap.go')
-rw-r--r--worker/imap/seqmap.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/worker/imap/seqmap.go b/worker/imap/seqmap.go
index 3558fe48..4a845865 100644
--- a/worker/imap/seqmap.go
+++ b/worker/imap/seqmap.go
@@ -14,7 +14,8 @@ type SeqMap struct {
// Initialize sets the initial seqmap of the mailbox
func (s *SeqMap) Initialize(uids []uint32) {
s.lock.Lock()
- s.m = uids
+ s.m = make([]uint32, len(uids))
+ copy(s.m, uids)
s.sort()
s.lock.Unlock()
}