about summary refs log tree commit diff stats
path: root/commands/msg
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2019-12-18 06:34:06 +0100
committerDrew DeVault <sir@cmpwn.com>2019-12-21 09:27:53 -0500
commita744df724f8b7acb0ac231a615192d33c414012e (patch)
treeb5abf1aa47c73a39f246b9937e5774ec8e030f3a /commands/msg
parent113de3596120b78aa78acb9e3335fd40029651da (diff)
downloadaerc-a744df724f8b7acb0ac231a615192d33c414012e.tar.gz
modify-labels: adapt to ProvidesMessages
Diffstat (limited to 'commands/msg')
-rw-r--r--commands/msg/modify-labels.go17
1 files changed, 7 insertions, 10 deletions
diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go
index f33a9ca..a18fc15 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) {