aerc/commands/account/check-mail.go
Tim Culverhouse db195bebf0 commands: add check-mail command
Add :check-mail command for ad-hoc checking of mail. Reset timer for
automatic checking if it is enabled.

Suggested-by: staceee
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
2022-08-01 10:37:28 +02:00

32 lines
517 B
Go

package account
import (
"errors"
"git.sr.ht/~rjarry/aerc/widgets"
)
type CheckMail struct{}
func init() {
register(CheckMail{})
}
func (CheckMail) Aliases() []string {
return []string{"check-mail"}
}
func (CheckMail) Complete(aerc *widgets.Aerc, args []string) []string {
return nil
}
func (CheckMail) Execute(aerc *widgets.Aerc, args []string) error {
acct := aerc.SelectedAccount()
if acct == nil {
return errors.New("No account selected")
}
acct.CheckMailReset()
acct.CheckMail()
return nil
}