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>
This commit is contained in:
Tim Culverhouse 2022-07-29 13:30:02 -05:00 committed by Robin Jarry
parent 44651b43b3
commit db195bebf0
4 changed files with 56 additions and 2 deletions
commands/account

View file

@ -0,0 +1,31 @@
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
}