about summary refs log tree commit diff stats
path: root/commands/msg
diff options
context:
space:
mode:
authorKevin Kuehler <kkuehler@brave.com>2019-06-10 22:27:54 -0700
committerDrew DeVault <sir@cmpwn.com>2019-06-11 09:18:51 -0400
commitd1df7103280ef488434b103e5e9e3129c407e5b6 (patch)
tree8226b3c4bde8208c544a39fe9aedb41a845d3c6e /commands/msg
parentd22a9140cdd34960cc2a50b2ae9011091f39118b (diff)
downloadaerc-d1df7103280ef488434b103e5e9e3129c407e5b6.tar.gz
commands/msg/archive: Work with msgviwer
Inside the generic msg command we cannot use aerc.SelectedAccount()
because the method naively assumes the current tab is an AccountView.
Use the ProvidesMessage interface instead.

Signed-off-by: Kevin Kuehler <kkuehler@brave.com>
Diffstat (limited to 'commands/msg')
-rw-r--r--commands/msg/archive.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/commands/msg/archive.go b/commands/msg/archive.go
index 11752f7..da4c421 100644
--- a/commands/msg/archive.go
+++ b/commands/msg/archive.go
@@ -26,12 +26,13 @@ func Archive(aerc *widgets.Aerc, args []string) error {
 	if len(args) != 2 {
 		return errors.New("Usage: archive <flat|year|month>")
 	}
-	acct := aerc.SelectedAccount()
+	widget := aerc.SelectedTab().(widgets.ProvidesMessage)
+	acct := widget.SelectedAccount()
 	if acct == nil {
 		return errors.New("No account selected")
 	}
-	msg := acct.Messages().Selected()
-	store := acct.Messages().Store()
+	msg := widget.SelectedMessage()
+	store := widget.Store()
 	archiveDir := acct.AccountConfig().Archive
 	acct.Messages().Next()