From beae17a6da37402d1c69dc76b476f55cbae982b8 Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Wed, 19 Jan 2022 13:18:10 +0100 Subject: 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 --- widgets/account.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'widgets') 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)) -- cgit