aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/account.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-02-05 00:07:16 +0100
committerRobin Jarry <robin@jarry.cc>2022-02-06 17:06:20 +0100
commit05ad96a30cb8ea17970c84ea7c72f8f3def5afa5 (patch)
treefdacf5548477bf0f470793d50885f6ea82210191 /widgets/account.go
parent4bd4f4664a36f22efad6f6a2cf8861928098e8c4 (diff)
downloadaerc-05ad96a30cb8ea17970c84ea7c72f8f3def5afa5.tar.gz
imap: improve reconnect stability
improves the robustness of the imap reconnect feature which was introduced in commit beae17a6da37 ("imap: auto-reconnects on connection error"). If a connection error is emitted, the message list is cleared and a corresponding error message is shown in the ui. Status bar is updated as well. Upon reconnect, the directories and the message list will be re-fetched (same behavior as the connect command). Reconnect can be enabled and disabled with the connect and the disconnect commands. Signed-off-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'widgets/account.go')
-rw-r--r--widgets/account.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/widgets/account.go b/widgets/account.go
index f9700301..8dbaba3e 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -289,8 +289,10 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
case *types.LabelList:
acct.labels = msg.Labels
case *types.ConnError:
- acct.logger.Printf("Connection error = %v", msg.Error)
+ acct.logger.Printf("connection error: %v", msg.Error)
+ acct.host.SetStatus("Disconnected.")
acct.aerc.PushError(fmt.Sprintf("%v", msg.Error))
+ acct.msglist.SetStore(nil)
acct.worker.PostAction(&types.Reconnect{}, nil)
case *types.Error:
acct.logger.Printf("%v", msg.Error)