From 455c6f0b774bb5e37906dd3fb8c786892f0b1519 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 19 May 2019 18:23:34 -0400 Subject: Rename :delete-message et al to :delete et al --- commands/account/view.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 commands/account/view.go (limited to 'commands/account/view.go') diff --git a/commands/account/view.go b/commands/account/view.go new file mode 100644 index 0000000..40abec3 --- /dev/null +++ b/commands/account/view.go @@ -0,0 +1,30 @@ +package account + +import ( + "errors" + + "git.sr.ht/~sircmpwn/aerc/widgets" +) + +func init() { + register("view", ViewMessage) + register("view-message", ViewMessage) +} + +func ViewMessage(aerc *widgets.Aerc, args []string) error { + if len(args) != 1 { + return errors.New("Usage: view-message") + } + acct := aerc.SelectedAccount() + if acct.Messages().Empty() { + return nil + } + store := acct.Messages().Store() + msg := acct.Messages().Selected() + if msg == nil { + return nil + } + viewer := widgets.NewMessageViewer(aerc.Config(), store, msg) + aerc.NewTab(viewer, msg.Envelope.Subject) + return nil +} -- cgit 1.4.1-2-gfad0