From a744df724f8b7acb0ac231a615192d33c414012e Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Wed, 18 Dec 2019 06:34:06 +0100 Subject: modify-labels: adapt to ProvidesMessages --- commands/msg/modify-labels.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go index f33a9caa..a18fc157 100644 --- a/commands/msg/modify-labels.go +++ b/commands/msg/modify-labels.go @@ -29,19 +29,16 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error { return errors.New("Usage: modify-labels <[+-]label> ...") } - widget := aerc.SelectedTab().(widgets.ProvidesMessage) - acct := widget.SelectedAccount() - if acct == nil { - return errors.New("No account selected") - } - store := widget.Store() - if store == nil { - return errors.New("Cannot perform action. Messages still loading") + h := newHelper(aerc) + store, err := h.store() + if err != nil { + return err } - msg, err := widget.SelectedMessage() + uids, err := h.uids() if err != nil { return err } + var add, remove []string for _, l := range changes { switch l[0] { @@ -54,7 +51,7 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error { add = append(add, l) } } - store.ModifyLabels([]uint32{msg.Uid}, add, remove, func( + store.ModifyLabels(uids, add, remove, func( msg types.WorkerMessage) { switch msg := msg.(type) { -- cgit