forked from Silverfish/proton-bridge
feat: attach public key
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user