From 476a94eef81658cb2f9b3435420401899ea33bf6 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Sat, 1 Apr 2023 16:51:33 +0200 Subject: accounts: warn for starttls deprecation only once If the user has several accounts with smtp-starttls=yes set, they will be warned multiple times for each account. This is confusing and may let the user believe that aerc is stuck because closing the dialog seems to have no effect. Only warn once. Fixes: c09b17a930cc ("smtp: replace smtp-starttls with schema option") Reported-by: Inwit Signed-off-by: Robin Jarry Acked-by: Moritz Poldrack --- config/accounts.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'config/accounts.go') diff --git a/config/accounts.go b/config/accounts.go index 656abf29..57ae2e66 100644 --- a/config/accounts.go +++ b/config/accounts.go @@ -135,6 +135,7 @@ func parseAccounts(root string, accts []string) error { return err } + starttls_warned := false for _, _sec := range file.SectionStrings() { if _sec == "DEFAULT" { continue @@ -164,7 +165,7 @@ func parseAccounts(root string, accts []string) error { account.Params[key] = val } } - if _, ok := account.Params["smtp-starttls"]; ok { + if _, ok := account.Params["smtp-starttls"]; ok && !starttls_warned { Warnings = append(Warnings, Warning{ Title: "accounts.conf: smtp-starttls is deprecated", Body: ` @@ -173,6 +174,7 @@ SMTP connections now use STARTTLS by default and the smtp-starttls setting is ig If you want to disable STARTTLS, append +insecure to the schema. `, }) + starttls_warned = true } if account.Source == "" { return fmt.Errorf("Expected source for account %s", _sec) -- cgit