aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/account.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2023-06-26 10:17:20 +0200
committerRobin Jarry <robin@jarry.cc>2023-06-26 10:53:57 +0200
commitdfabb5232875663884d35f7d69b752f0b56ad64b (patch)
tree2363951318234842e1a0a289b13874c62e3b9bb9 /widgets/account.go
parent9cbfb190f65eba73e42b034a39de4b4d35fd404c (diff)
downloadaerc-dfabb5232875663884d35f7d69b752f0b56ad64b.tar.gz
account: remember folder/message when reconnecting
Remember selected folder and message when reconnecting. This is mostly useful for the imap backend when logouts or reconnects happen a lot. Fixes: https://todo.sr.ht/~rjarry/aerc/159 Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc> Tested-by: inwit <inwit@sindominio.net>
Diffstat (limited to 'widgets/account.go')
-rw-r--r--widgets/account.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/widgets/account.go b/widgets/account.go
index 0c2ce7d6..e9c86504 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -299,7 +299,8 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
}
case *types.ListDirectories:
acct.dirlist.Update(msg)
- if acct.dirlist.Selected() != "" {
+ if dir := acct.dirlist.Selected(); dir != "" {
+ acct.dirlist.Select(dir)
return
}
// Nothing selected, select based on config
@@ -321,7 +322,10 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
acct.newConn = true
}
case *types.Directory:
- store := acct.newStore(msg.Dir.Name)
+ store, ok := acct.dirlist.MsgStore(msg.Dir.Name)
+ if !ok {
+ store = acct.newStore(msg.Dir.Name)
+ }
acct.dirlist.SetMsgStore(msg.Dir, store)
case *types.DirectoryInfo:
acct.dirlist.Update(msg)