aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/account-wizard.go
diff options
context:
space:
mode:
authorNoah Loomans <noah@noahloomans.com>2019-06-18 14:07:51 +0200
committerDrew DeVault <sir@cmpwn.com>2019-06-18 19:40:02 -0400
commitd1654def192459f829496791406483a1286805e7 (patch)
tree43191f5f9f08f9837463fcf96b076b0b754dcfac /widgets/account-wizard.go
parent53df15ae06214b2c2e4aa176f125093334c8c0f9 (diff)
downloadaerc-d1654def192459f829496791406483a1286805e7.tar.gz
account-wizard: automatically replace imap.* with smtp.*
Many email providers use the imap sub-domain for imap and the smtp sub-domain for smtp. FastMail is an example of this[1]. This is a small quality-of-life improvement which automatically replaces imap.* with smtp.* when going from the imap screen to the smtp screen in the wizard [1]: https://www.fastmail.com/help/technical/servernamesandports.html
Diffstat (limited to 'widgets/account-wizard.go')
-rw-r--r--widgets/account-wizard.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go
index 010d82d5..3d9cfd40 100644
--- a/widgets/account-wizard.go
+++ b/widgets/account-wizard.go
@@ -105,7 +105,12 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
wizard.smtpUri()
})
wizard.imapServer.OnChange(func(_ *ui.TextInput) {
- wizard.smtpServer.Set(wizard.imapServer.String())
+ imapServerURI := wizard.imapServer.String()
+ smtpServerURI := imapServerURI
+ if strings.HasPrefix(imapServerURI, "imap.") {
+ smtpServerURI = strings.Replace(imapServerURI, "imap.", "smtp.", 1)
+ }
+ wizard.smtpServer.Set(smtpServerURI)
wizard.imapUri()
wizard.smtpUri()
})