aboutsummaryrefslogtreecommitdiff
path: root/commands/account/view-message.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-31 12:14:37 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-31 12:14:37 -0400
commit27b25174e2f0249a6a1d4ba45b70f8504b63ffb1 (patch)
treeb8626c746e07d9a38f95a5a817a7094c9275bfd1 /commands/account/view-message.go
parent143289bbd0736d72553a3c2a080aa3d125366b38 (diff)
Make the message viewer real, part one
Diffstat (limited to 'commands/account/view-message.go')
-rw-r--r--commands/account/view-message.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/commands/account/view-message.go b/commands/account/view-message.go
new file mode 100644
index 0000000..bef2740
--- /dev/null
+++ b/commands/account/view-message.go
@@ -0,0 +1,27 @@
+package account
+
+import (
+ "errors"
+
+ "github.com/mattn/go-runewidth"
+
+ "git.sr.ht/~sircmpwn/aerc2/widgets"
+)
+
+func init() {
+ 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()
+ store := acct.Messages().Store()
+ msg := acct.Messages().Selected()
+ viewer := widgets.NewMessageViewer(store, msg)
+ aerc.NewTab(viewer, runewidth.Truncate(
+ msg.Envelope.Subject, 32, "…"))
+ return nil
+}
+