summary refs log tree commit diff stats
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
parent113de3596120b78aa78acb9e3335fd40029651da (diff)
downloadaerc-a744df724f8b7acb0ac231a615192d33c414012e.tar.gz
modify-labels: adapt to ProvidesMessages
-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) {
'n163' href='#n163'>163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238