feat: attach public key

This commit is contained in:
James Houlahan
2020-07-02 16:17:04 +02:00
parent 45b863f931
commit 2b36d3ab7b
6 changed files with 98 additions and 70 deletions

View File

@ -1,6 +1,8 @@
package parser
import (
"errors"
"github.com/emersion/go-message"
)
@ -10,6 +12,22 @@ type Part struct {
children []*Part
}
func (p *Part) Part(n int) (part *Part, err error) {
if len(p.children) < n {
return nil, errors.New("no such part")
}
return p.children[n-1], nil
}
func (p *Part) Parts() (n int) {
return len(p.children)
}
func (p *Part) AddChild(child *Part) {
p.children = append(p.children, child)
}
func (p *Part) visit(w *Walker) (err error) {
if err = p.handle(w); err != nil {
return