aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-08-30 10:36:41 -0500
committerRobin Jarry <robin@jarry.cc>2022-08-30 21:42:37 +0200
commitf530cd96f316e6821e59351e15b1be5628e0804c (patch)
tree9164dfc8574e62e4e6f1b53350ed66880f45d5fe
parent380cf13cff8e1f44f7f9705d17abb4a54d478033 (diff)
downloadaerc-f530cd96f316e6821e59351e15b1be5628e0804c.tar.gz
msgstore: enable granularity in updating of threadbuilder
Enable the msgstore to specify if an update should also update the threadbuilder. Certain calls to msgstore.update() did not require the threadbuilder to run, as it was either called implicitly through other means (nextPrev during a search) OR it was not needed (IE in the case of a DirectoryInfo message). Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--lib/msgstore.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index 0abd26ed..5655f9e0 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -188,6 +188,7 @@ func merge(to *models.MessageInfo, from *models.MessageInfo) {
func (store *MessageStore) Update(msg types.WorkerMessage) {
update := false
+ updateThreads := false
directoryChange := false
switch msg := msg.(type) {
case *types.DirectoryInfo:
@@ -255,6 +256,7 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
store.builder.Update(msg.Info)
}
update = true
+ updateThreads = true
case *types.FullMessage:
if _, ok := store.pendingBodies[msg.Content.Uid]; ok {
delete(store.pendingBodies, msg.Content.Uid)
@@ -305,10 +307,11 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
}
update = true
+ updateThreads = true
}
if update {
- store.update()
+ store.update(updateThreads)
}
if directoryChange && store.triggerDirectoryChange != nil {
@@ -328,14 +331,14 @@ func (store *MessageStore) OnUpdateDirs(fn func()) {
store.onUpdateDirs = fn
}
-func (store *MessageStore) update() {
+func (store *MessageStore) update(threads bool) {
if store.onUpdate != nil {
store.onUpdate(store)
}
if store.onUpdateDirs != nil {
store.onUpdateDirs()
}
- if store.BuildThreads() && store.ThreadedView() {
+ if store.BuildThreads() && store.ThreadedView() && threads {
store.runThreadBuilder()
}
}
@@ -654,7 +657,7 @@ func (store *MessageStore) nextPrevResult(delta int) {
store.resultIndex = len(store.results) - 1
}
store.Select(store.results[len(store.results)-store.resultIndex-1])
- store.update()
+ store.update(false)
}
func (store *MessageStore) NextResult() {