From 77ede6eb5a22a5407541ac587736189fcca0037f Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 29 Mar 2019 22:35:53 -0400 Subject: Add body fetching support code --- commands/account/fetch-msg.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 commands/account/fetch-msg.go (limited to 'commands/account') diff --git a/commands/account/fetch-msg.go b/commands/account/fetch-msg.go new file mode 100644 index 0000000..631a8ee --- /dev/null +++ b/commands/account/fetch-msg.go @@ -0,0 +1,29 @@ +package account + +import ( + "errors" + + "github.com/mohamedattahri/mail" + + "git.sr.ht/~sircmpwn/aerc2/widgets" +) + +func init() { + register("fetch-message", FetchMessage) +} + +func FetchMessage(aerc *widgets.Aerc, args []string) error { + if len(args) != 1 { + return errors.New("Usage: :fetch-message") + } + acct := aerc.SelectedAccount() + if acct == nil { + return errors.New("No account selected") + } + store := acct.Messages().Store() + msg := acct.Messages().Selected() + store.FetchBodies([]uint32{msg.Uid}, func(msg *mail.Message) { + aerc.SetStatus("got message body, woohoo") + }) + return nil +} -- cgit v1.2.3