aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-04-01 16:51:33 +0200
committerRobin Jarry <robin@jarry.cc>2023-04-02 13:28:24 +0200
commit476a94eef81658cb2f9b3435420401899ea33bf6 (patch)
treec3df48876af096b50e7dd0168556345724aad8a3
parentb46b2d22824a4feb351f27fff8dce3d6947b190b (diff)
downloadaerc-476a94eef81658cb2f9b3435420401899ea33bf6.tar.gz
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 <inwit@sindominio.net> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
-rw-r--r--config/accounts.go4
1 files changed, 3 insertions, 1 deletions
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)