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:
parent
c816103a24
commit
44651b43b3
2 changed files with 8 additions and 0 deletions
|
@ -708,6 +708,10 @@ func (w *Worker) msgInfoFromUid(uid uint32) (*models.MessageInfo, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Worker) handleCheckMail(msg *types.CheckMail) {
|
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)
|
ctx, cancel := context.WithTimeout(context.Background(), msg.Timeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
cmd := exec.CommandContext(ctx, "sh", "-c", msg.Command)
|
cmd := exec.CommandContext(ctx, "sh", "-c", msg.Command)
|
||||||
|
|
|
@ -647,6 +647,10 @@ func (w *worker) sort(uids []uint32,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *worker) handleCheckMail(msg *types.CheckMail) {
|
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)
|
ctx, cancel := context.WithTimeout(context.Background(), msg.Timeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
cmd := exec.CommandContext(ctx, "sh", "-c", msg.Command)
|
cmd := exec.CommandContext(ctx, "sh", "-c", msg.Command)
|
||||||
|
|
Loading…
Reference in a new issue