aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-13 20:16:55 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-13 20:16:55 -0400
commit026e8a17ca40955652949584388b38566fef66e7 (patch)
treea6430ec16308dc35ddeb1bc7f381a27124427739 /widgets
parentbb46b2b7e15ba839475973ae44d5a833c6f2b265 (diff)
downloadaerc-026e8a17ca40955652949584388b38566fef66e7.tar.gz
Handle incoming emails gracefully
Diffstat (limited to 'widgets')
-rw-r--r--widgets/account.go12
-rw-r--r--widgets/msglist.go1
2 files changed, 7 insertions, 6 deletions
diff --git a/widgets/account.go b/widgets/account.go
index c01b15f7..ba2b8d35 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -161,17 +161,17 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
} else {
acct.msglist.SetStore(nil)
}
- acct.worker.PostAction(&types.FetchDirectoryContents{},
- func(msg types.WorkerMessage) {
- store := acct.msgStores[acct.dirlist.selected]
- acct.msglist.SetStore(store)
- })
}
case *types.DirectoryInfo:
if store, ok := acct.msgStores[msg.Name]; ok {
store.Update(msg)
} else {
- acct.msgStores[msg.Name] = lib.NewMessageStore(acct.worker, msg)
+ store = lib.NewMessageStore(acct.worker, msg)
+ acct.msgStores[msg.Name] = store
+ store.OnUpdate(func(_ *lib.MessageStore) {
+ store.OnUpdate(nil)
+ acct.msglist.SetStore(store)
+ })
}
case *types.DirectoryContents:
store := acct.msgStores[acct.dirlist.selected]
diff --git a/widgets/msglist.go b/widgets/msglist.go
index eeadec72..65473a84 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -109,6 +109,7 @@ func (ml *MessageList) Height() int {
}
func (ml *MessageList) storeUpdate(store *lib.MessageStore) {
+ ml.logger.Println("message store updated")
if ml.Store() != store {
return
}