aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-01-19 13:18:10 +0100
committerRobin Jarry <robin@jarry.cc>2022-01-19 17:40:52 +0100
commitbeae17a6da37402d1c69dc76b476f55cbae982b8 (patch)
tree94309a87346dc320627a032bfce73f58bcc77412 /widgets
parent1ace50a6b927fde7ef3205001a7acd91e04ac2d7 (diff)
downloadaerc-beae17a6da37402d1c69dc76b476f55cbae982b8.tar.gz
imap: auto-reconnects on connection error
if the worker emits a connection error, the ui will automatically send back a reconnect command. The worker then establishes a new connection. Auto-reconnect is disabled when the user sends the disconnect command. Fixes: https://todo.sr.ht/~rjarry/aerc/1 Signed-off-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'widgets')
-rw-r--r--widgets/account.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/widgets/account.go b/widgets/account.go
index beedabca..f9700301 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -202,7 +202,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
switch msg := msg.(type) {
case *types.Done:
switch msg.InResponseTo().(type) {
- case *types.Connect:
+ case *types.Connect, *types.Reconnect:
acct.host.SetStatus("Listing mailboxes...")
acct.logger.Println("Listing mailboxes...")
acct.dirlist.UpdateList(func(dirs []string) {
@@ -291,6 +291,7 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
case *types.ConnError:
acct.logger.Printf("Connection error = %v", msg.Error)
acct.aerc.PushError(fmt.Sprintf("%v", msg.Error))
+ acct.worker.PostAction(&types.Reconnect{}, nil)
case *types.Error:
acct.logger.Printf("%v", msg.Error)
acct.aerc.PushError(fmt.Sprintf("%v", msg.Error))