aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJeffas <dev@jeffas.io>2019-09-11 17:37:21 +0100
committerDrew DeVault <sir@cmpwn.com>2019-09-11 12:37:43 -0400
commit618a500341d54ec5bec6d035a86b1307ff1dad0a (patch)
tree090fdff220eeb29e4bee7347a16d9e5ff7fbd0b9 /lib
parent572d9ff72883264fbffe35e998b9a6193f20137a (diff)
Add display of unread messages in dirlist
Add an onUpdateDirs handler. This is used to invalidate the dirlist and redraw with the correct number of recent/unread/total messages is shown. A config option and formatting options are provided.
Diffstat (limited to 'lib')
-rw-r--r--lib/msgstore.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index bbdfa57..2733288 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -27,6 +27,7 @@ type MessageStore struct {
// Map of uids we've asked the worker to fetch
onUpdate func(store *MessageStore) // TODO: multiple onUpdate handlers
+ onUpdateDirs func()
pendingBodies map[uint32]interface{}
pendingHeaders map[uint32]interface{}
worker *types.Worker
@@ -234,10 +235,17 @@ func (store *MessageStore) OnUpdate(fn func(store *MessageStore)) {
store.onUpdate = fn
}
+func (store *MessageStore) OnUpdateDirs(fn func()) {
+ store.onUpdateDirs = fn
+}
+
func (store *MessageStore) update() {
if store.onUpdate != nil {
store.onUpdate(store)
}
+ if store.onUpdateDirs != nil {
+ store.onUpdateDirs()
+ }
}
func (store *MessageStore) Delete(uids []uint32,