checkmail: error if check-mail-cmd is not set

Send error message to UI if check-mail-cmd is required but not set.

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:01 -05:00 committed by Robin Jarry
parent c816103a24
commit 44651b43b3
2 changed files with 8 additions and 0 deletions

View File

@ -708,6 +708,10 @@ func (w *Worker) msgInfoFromUid(uid uint32) (*models.MessageInfo, error) {
}
func (w *Worker) handleCheckMail(msg *types.CheckMail) {
if msg.Command == "" {
w.err(msg, fmt.Errorf("checkmail: no command specified"))
return
}
ctx, cancel := context.WithTimeout(context.Background(), msg.Timeout)
defer cancel()
cmd := exec.CommandContext(ctx, "sh", "-c", msg.Command)

View File

@ -647,6 +647,10 @@ func (w *worker) sort(uids []uint32,
}
func (w *worker) handleCheckMail(msg *types.CheckMail) {
if msg.Command == "" {
w.err(msg, fmt.Errorf("checkmail: no command specified"))
return
}
ctx, cancel := context.WithTimeout(context.Background(), msg.Timeout)
defer cancel()
cmd := exec.CommandContext(ctx, "sh", "-c", msg.Command)