save: add -a option to save all attachments
Allow saving all message parts that have the content disposition "attachment" header to a folder. Suggested-by: Ondřej Synáček <ondrej@synacek.org> Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Koni Marti <koni.marti@gmail.com> Tested-by: Moritz Poldrack <moritz@poldrack.dev>
This commit is contained in:
parent
d66930749a
commit
d64ceba2cc
3 changed files with 70 additions and 19 deletions
widgets
|
@ -303,6 +303,23 @@ func (mv *MessageViewer) SelectedMessagePart() *PartInfo {
|
|||
}
|
||||
}
|
||||
|
||||
func (mv *MessageViewer) AttachmentParts() []*PartInfo {
|
||||
var attachments []*PartInfo
|
||||
|
||||
for _, p := range mv.switcher.parts {
|
||||
if p.part.Disposition == "attachment" {
|
||||
pi := &PartInfo{
|
||||
Index: p.index,
|
||||
Msg: p.msg.MessageInfo(),
|
||||
Part: p.part,
|
||||
}
|
||||
attachments = append(attachments, pi)
|
||||
}
|
||||
}
|
||||
|
||||
return attachments
|
||||
}
|
||||
|
||||
func (mv *MessageViewer) PreviousPart() {
|
||||
switcher := mv.switcher
|
||||
for {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue