aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/account.go6
-rw-r--r--widgets/aerc.go13
-rw-r--r--widgets/msglist.go5
3 files changed, 19 insertions, 5 deletions
diff --git a/widgets/account.go b/widgets/account.go
index f070df14..92e7a560 100644
--- a/widgets/account.go
+++ b/widgets/account.go
@@ -203,7 +203,11 @@ func (acct *AccountView) onMessage(msg types.WorkerMessage) {
if store, ok := acct.msgStores[msg.Info.Name]; ok {
store.Update(msg)
} else {
- store = lib.NewMessageStore(acct.worker, msg.Info)
+ store = lib.NewMessageStore(acct.worker, msg.Info,
+ func(msg *models.MessageInfo) {
+ acct.conf.Triggers.ExecNewEmail(acct.acct,
+ acct.conf, msg)
+ })
acct.msgStores[msg.Info.Name] = store
store.OnUpdate(func(_ *lib.MessageStore) {
store.OnUpdate(nil)
diff --git a/widgets/aerc.go b/widgets/aerc.go
index 079d4429..3cf1f647 100644
--- a/widgets/aerc.go
+++ b/widgets/aerc.go
@@ -8,6 +8,7 @@ import (
"time"
"github.com/gdamore/tcell"
+ "github.com/google/shlex"
"git.sr.ht/~sircmpwn/aerc/config"
"git.sr.ht/~sircmpwn/aerc/lib/ui"
@@ -16,7 +17,7 @@ import (
type Aerc struct {
accounts map[string]*AccountView
- cmd func(cmd string) error
+ cmd func(cmd []string) error
complete func(cmd string) []string
conf *config.AercConfig
focused libui.Interactive
@@ -30,7 +31,7 @@ type Aerc struct {
}
func NewAerc(conf *config.AercConfig, logger *log.Logger,
- cmd func(cmd string) error, complete func(cmd string) []string) *Aerc {
+ cmd func(cmd []string) error, complete func(cmd string) []string) *Aerc {
tabs := libui.NewTabs()
@@ -62,6 +63,7 @@ func NewAerc(conf *config.AercConfig, logger *log.Logger,
}
statusline.SetAerc(aerc)
+ conf.Triggers.ExecuteCommand = cmd
for i, acct := range conf.Accounts {
view := NewAccountView(conf, &conf.Accounts[i], logger, aerc)
@@ -311,7 +313,12 @@ func (aerc *Aerc) focus(item libui.Interactive) {
func (aerc *Aerc) BeginExCommand() {
previous := aerc.focused
exline := NewExLine(func(cmd string) {
- err := aerc.cmd(cmd)
+ parts, err := shlex.Split(cmd)
+ if err != nil {
+ aerc.PushStatus(" "+err.Error(), 10*time.Second).
+ Color(tcell.ColorDefault, tcell.ColorRed)
+ }
+ err = aerc.cmd(parts)
if err != nil {
aerc.PushStatus(" "+err.Error(), 10*time.Second).
Color(tcell.ColorDefault, tcell.ColorRed)
diff --git a/widgets/msglist.go b/widgets/msglist.go
index e8ba8c1d..abf69212 100644
--- a/widgets/msglist.go
+++ b/widgets/msglist.go
@@ -9,6 +9,7 @@ import (
"git.sr.ht/~sircmpwn/aerc/config"
"git.sr.ht/~sircmpwn/aerc/lib"
+ "git.sr.ht/~sircmpwn/aerc/lib/format"
"git.sr.ht/~sircmpwn/aerc/lib/ui"
"git.sr.ht/~sircmpwn/aerc/models"
)
@@ -95,7 +96,9 @@ func (ml *MessageList) Draw(ctx *ui.Context) {
}
ctx.Fill(0, row, ctx.Width(), 1, ' ', style)
- fmtStr, args, err := lib.ParseIndexFormat(ml.conf, i, msg)
+ fmtStr, args, err := format.ParseMessageFormat(
+ ml.conf.Ui.IndexFormat,
+ ml.conf.Ui.TimestampFormat, "", i, msg)
if err != nil {
ctx.Printf(0, row, style, "%v", err)
} else {