From 618a500341d54ec5bec6d035a86b1307ff1dad0a Mon Sep 17 00:00:00 2001 From: Jeffas Date: Wed, 11 Sep 2019 17:37:21 +0100 Subject: 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. --- lib/msgstore.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/msgstore.go') diff --git a/lib/msgstore.go b/lib/msgstore.go index bbdfa575..27332884 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, -- cgit