diff options
author | Robin Jarry <robin@jarry.cc> | 2022-12-20 20:29:12 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-01-04 22:57:31 +0100 |
commit | 37e9a924894db7e5f232e82066155a60827c339b (patch) | |
tree | 48deeeea33113bbc9e6fcbcb8973a3ba1d62a06d /widgets/account-wizard.go | |
parent | c56027b2e69ec198e41394e5cf906273d80baf79 (diff) | |
download | aerc-37e9a924894db7e5f232e82066155a60827c339b.tar.gz |
config: parse account from and aliases once
Instead of accepting any garbage for these configuration fields, parse
them when parsing accounts.conf and store mail.Address objects. Reuse
these objects everywhere.
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'widgets/account-wizard.go')
-rw-r--r-- | widgets/account-wizard.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go index 2ff87241..4b948a30 100644 --- a/widgets/account-wizard.go +++ b/widgets/account-wizard.go @@ -13,6 +13,7 @@ import ( "sync" "time" + "github.com/emersion/go-message/mail" "github.com/gdamore/tcell/v2" "github.com/go-ini/ini" "github.com/kyoh86/xdg" @@ -531,10 +532,16 @@ func (wizard *AccountWizard) finish(tutorial bool) { } } + from, err := mail.ParseAddress(sec.Key("from").String()) + if err != nil { + wizard.errorFor(nil, err) + return + } + account := config.AccountConfig{ Name: sec.Name(), Default: "INBOX", - From: sec.Key("from").String(), + From: from, Source: sec.Key("source").String(), Outgoing: config.RemoteConfig{Value: sec.Key("outgoing").String()}, } |