1
0
mirror of https://git.sr.ht/~sircmpwn/aerc synced 2024-11-23 16:42:07 +01:00

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
This commit is contained in:
Noah Loomans 2019-06-18 14:07:51 +02:00 committed by Drew DeVault
parent 53df15ae06
commit d1654def19

@ -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()
})