Add body fetching support code
This commit is contained in:
parent
84e9853c16
commit
77ede6eb5a
9 changed files with 165 additions and 24 deletions
commands/account
29
commands/account/fetch-msg.go
Normal file
29
commands/account/fetch-msg.go
Normal file
|
@ -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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue