summary refs log tree commit diff stats
path: root/widgets/account.go
diff options
context:
space:
mode:
authorBen Burwell <ben@benburwell.com>2019-07-07 22:43:56 -0400
committerDrew DeVault <sir@cmpwn.com>2019-07-08 16:06:23 -0400
commitcce7cb48081ca090ac2d3a0e781dfbc25d581946 (patch)
tree0709eff3daf75ac975bc9e12f068d7951aeaefe6 /widgets/account.go
parentc79577d37675c8d9ed3355c532a215377e76d3b2 (diff)
downloadaerc-cce7cb48081ca090ac2d3a0e781dfbc25d581946.tar.gz
Factor UI models out of the worker message package
Before, the information needed to display different parts of the UI was
tightly coupled to the specific messages being sent back and forth to
the backend worker. Separating out a models package allows us to be more
specific about exactly what a backend is able to and required to
provide for the UI.
Diffstat (limited to 'widgets/account.go')
-rw-r--r--widgets/account.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/widgets/account.go b/widgets/account.go
index 0948c5c..e08a253 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -9,6 +9,7 @@ import (
 	"git.sr.ht/~sircmpwn/aerc/config"
 	"git.sr.ht/~sircmpwn/aerc/lib"
 	"git.sr.ht/~sircmpwn/aerc/lib/ui"
+	"git.sr.ht/~sircmpwn/aerc/models"
 	"git.sr.ht/~sircmpwn/aerc/worker"
 	"git.sr.ht/~sircmpwn/aerc/worker/types"
 )
@@ -169,7 +170,7 @@ func (acct *AccountView) SelectedAccount() *AccountView {
 	return acct
 }
 
-func (acct *AccountView) SelectedMessage() *types.MessageInfo {
+func (acct *AccountView) SelectedMessage() *models.MessageInfo {
 	return acct.msglist.Selected()
 }
 
@@ -195,11 +196,11 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
 			acct.dirlist.UpdateList(nil)
 		}
 	case *types.DirectoryInfo:
-		if store, ok := acct.msgStores[msg.Name]; ok {
+		if store, ok := acct.msgStores[msg.Info.Name]; ok {
 			store.Update(msg)
 		} else {
-			store = lib.NewMessageStore(acct.worker, msg)
-			acct.msgStores[msg.Name] = store
+			store = lib.NewMessageStore(acct.worker, msg.Info)
+			acct.msgStores[msg.Info.Name] = store
 			store.OnUpdate(func(_ *lib.MessageStore) {
 				store.OnUpdate(nil)
 				acct.msglist.SetStore(store)