aboutsummaryrefslogtreecommitdiffstats
path: root/worker/maildir
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2023-04-16 09:53:36 -0500
committerRobin Jarry <robin@jarry.cc>2023-04-22 22:40:12 +0200
commit91ac21ac615582e2dd5e36f4b36bde1bc0bf38d8 (patch)
tree718dd2cdcb045ca50fdc98f5c6486e0c90c94f29 /worker/maildir
parent6220711f90d769cbee1ae855dd6a33964626f5a4 (diff)
downloadaerc-91ac21ac615582e2dd5e36f4b36bde1bc0bf38d8.tar.gz
msgstore: fetch message list based on OpenDirectory msg
Fetching the message list is done in a convoluted way. The UI receives a DirectoryInfo message, which creates a message store. It then receives a second DirectoryInfo (an oddity from the IMAP worker), and this DirectoryInfo is passed to the message store which then requests a fetch of the message list via store.Sort. Use the OpenDirectory done response to tell the message store to fetch messages. This makes the code easier to follow, and does not rely on quirks from the IMAP worker. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/maildir')
-rw-r--r--worker/maildir/worker.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index a94792bc..dc794a10 100644
--- a/worker/maildir/worker.go
+++ b/worker/maildir/worker.go
@@ -38,6 +38,7 @@ type Worker struct {
c *Container
selected *maildir.Dir
selectedName string
+ selectedInfo *models.DirectoryInfo
worker *types.Worker
watcher types.FSWatcher
currentSortCriteria []*types.SortCriterion
@@ -112,8 +113,13 @@ func (w *Worker) handleFSEvent(ev *types.FSEvent) {
}
dirInfo := w.getDirectoryInfo(w.selectedName)
+ var refetch bool
+ if dirInfo.Exists > w.selectedInfo.Exists {
+ refetch = true
+ }
w.worker.PostMessage(&types.DirectoryInfo{
- Info: dirInfo,
+ Info: dirInfo,
+ Refetch: refetch,
}, nil)
}
@@ -394,6 +400,7 @@ func (w *Worker) handleOpenDirectory(msg *types.OpenDirectory) error {
info := &types.DirectoryInfo{
Info: w.getDirectoryInfo(msg.Directory),
}
+ w.selectedInfo = info.Info
w.worker.PostMessage(info, nil)
return nil
}
@@ -865,8 +872,7 @@ func (w *Worker) handleCheckMail(msg *types.CheckMail) {
}
dirInfo := w.getDirectoryInfo(name)
w.worker.PostMessage(&types.DirectoryInfo{
- Info: dirInfo,
- SkipSort: true,
+ Info: dirInfo,
}, nil)
}
w.done(msg)