Add forwarding as attachment feature

This allows a single message to be forward as attachment with the
:forward -a command
This commit is contained in:
Jelle Besseling 2019-08-18 11:33:15 +02:00 committed by Drew DeVault
parent 36c6030e81
commit 1f5293931a
3 changed files with 73 additions and 5 deletions
widgets

View file

@ -42,6 +42,8 @@ type Composer struct {
layout HeaderLayout
focusable []ui.DrawableInteractive
focused int
onClose []func(ti *Composer)
}
func NewComposer(conf *config.AercConfig,
@ -169,6 +171,10 @@ func (c *Composer) OnHeaderChange(header string, fn func(subject string)) {
}
}
func (c *Composer) OnClose(fn func(composer *Composer)) {
c.onClose = append(c.onClose, fn)
}
func (c *Composer) Draw(ctx *ui.Context) {
c.grid.Draw(ctx)
}
@ -184,6 +190,9 @@ func (c *Composer) OnInvalidate(fn func(d ui.Drawable)) {
}
func (c *Composer) Close() {
for _, onClose := range c.onClose {
onClose(c)
}
if c.email != nil {
path := c.email.Name()
c.email.Close()