diff options
Diffstat (limited to 'widgets/account.go')
-rw-r--r-- | widgets/account.go | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/widgets/account.go b/widgets/account.go index fdd33301..fece0846 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -11,6 +11,7 @@ import ( "git.sr.ht/~rjarry/aerc/config" "git.sr.ht/~rjarry/aerc/lib" + "git.sr.ht/~rjarry/aerc/lib/hooks" "git.sr.ht/~rjarry/aerc/lib/marker" "git.sr.ht/~rjarry/aerc/lib/sort" "git.sr.ht/~rjarry/aerc/lib/state" @@ -288,14 +289,12 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) { acct.dirlist.UiConfig(name).ReverseThreadOrder, acct.dirlist.UiConfig(name).SortThreadSiblings, func(msg *models.MessageInfo) { - if len(config.Triggers.NewEmail) == 0 { - return - } - err := acct.aerc.cmd( - config.Triggers.NewEmail, - acct.acct, msg) + err := hooks.RunHook(&hooks.MailReceived{ + MsgInfo: msg, + }) if err != nil { - acct.aerc.PushError(err.Error()) + msg := fmt.Sprintf("mail-received hook: %s", err) + acct.aerc.PushError(msg) } }, func() { if acct.dirlist.UiConfig(name).NewMessageBell { |