aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/msgstore.go24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 064ad36..bfea081 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -15,7 +15,8 @@ type MessageStore struct {
DirInfo models.DirectoryInfo
Messages map[uint32]*models.MessageInfo
// Ordered list of known UIDs
- uids []uint32
+ uids []uint32
+ Threads []*types.Thread
selected int
bodyCallbacks map[uint32][]func(io.Reader)
@@ -173,6 +174,27 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
}, nil)
}
update = true
+ case *types.DirectoryThreaded:
+ var uids []uint32
+ newMap := make(map[uint32]*models.MessageInfo)
+
+ for i := len(msg.Threads) - 1; i >= 0; i-- {
+ msg.Threads[i].FormatThread(func(t *types.Thread, x string) bool {
+ uid := t.Uid
+ uids = append([]uint32{uid}, uids...)
+ if msg, ok := store.Messages[uid]; ok {
+ newMap[uid] = msg
+ } else {
+ newMap[uid] = nil
+ directoryChange = true
+ }
+ return false
+ })
+ }
+ store.Messages = newMap
+ store.uids = uids
+ store.Threads = msg.Threads
+ update = true
case *types.DirectoryContents:
newMap := make(map[uint32]*models.MessageInfo)
for _, uid := range msg.Uids {