aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-08-20 22:01:49 +0200
committerRobin Jarry <robin@jarry.cc>2023-08-26 21:41:05 +0200
commitaca324e17f83170170724369a9dfe822d01ee052 (patch)
tree17e7dbc97fca5fdc5153fd80d0b58bc86875e8e3
parentb89a380f4512f21341a80460cdbcee49367e13d3 (diff)
downloadaerc-aca324e17f83170170724369a9dfe822d01ee052.tar.gz
aerc-aca324e17f83170170724369a9dfe822d01ee052.zip
wizard: add imap cache-headers default setting
This seems like a sane default. Set it to true in accounts.conf. Add a note in the final screen to encourage users to review accounts.conf at their convenience. Signed-off-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Tristan Partin <tristan@partin.io> Tested-by: Tim Culverhouse <tim@timculverhouse.com>
-rw-r--r--widgets/account-wizard.go23
1 files changed, 20 insertions, 3 deletions
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index 5a629dca..835cb26a 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -2,6 +2,7 @@ package widgets
import (
"errors"
+ "fmt"
"net"
"net/url"
"os"
@@ -15,6 +16,7 @@ import (
"github.com/gdamore/tcell/v2"
"github.com/go-ini/ini"
"github.com/kyoh86/xdg"
+ "github.com/mitchellh/go-homedir"
"git.sr.ht/~rjarry/aerc/config"
"git.sr.ht/~rjarry/aerc/lib/format"
@@ -333,14 +335,17 @@ Press <Tab> and <Shift+Tab> to cycle between each field in this form, or <Ctrl+j
// CONFIGURE_COMPLETE
complete := NewConfigStep(
- `
+ fmt.Sprintf(`
Configuration complete!
You can go back and double check your settings, or choose [Finish] to
-save your settings to accounts.conf.
+save your settings to %s/accounts.conf.
+
+Make sure to review the contents of this file and read the
+aerc-accounts(5) man page for guidance and further tweaking.
To add another account in the future, run ':new-account'.
-`,
+`, tildeHome(path.Join(xdg.ConfigHome(), "aerc"))),
&wizard.complete,
)
complete.AddField(
@@ -446,6 +451,10 @@ func (wizard *AccountWizard) finish(tutorial bool) {
_, _ = sec.NewKey("copy-to", wizard.outgoingCopyTo.String())
}
+ if wizard.sourceProtocol.Selected() == IMAP {
+ _, _ = sec.NewKey("cache-headers", "true")
+ }
+
if !wizard.temporary {
f, err := os.OpenFile(accountsConf, os.O_WRONLY|os.O_CREATE, 0o600)
if err != nil {
@@ -729,3 +738,11 @@ func (wizard *AccountWizard) autofill() {
}
}
}
+
+func tildeHome(path string) string {
+ home, err := homedir.Dir()
+ if err == nil && home != "" && strings.HasPrefix(path, home) {
+ path = "~" + strings.TrimPrefix(path, home)
+ }
+ return path
+}