parser

package
v3.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlerFunc

type HandlerFunc func(*Part) error

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func New

func New(r io.Reader) (*Parser, error)

func (*Parser) AttachEmptyTextPartIfNoneExists added in v3.1.0

func (p *Parser) AttachEmptyTextPartIfNoneExists() bool

func (*Parser) AttachPublicKey

func (p *Parser) AttachPublicKey(key, keyName string)

func (*Parser) NewVisitor

func (p *Parser) NewVisitor(defaultRule VisitorRule) *Visitor

func (*Parser) NewWalker

func (p *Parser) NewWalker() *Walker

func (*Parser) NewWriter

func (p *Parser) NewWriter() *Writer

func (*Parser) Root

func (p *Parser) Root() *Part

func (*Parser) Section

func (p *Parser) Section(section []int) (part *Part, err error)

Section returns the message part referred to by the given section. A section is zero or more integers. For example, section 1.2.3 will return the third part of the second part of the first part of the message.

type Part

type Part struct {
	Header message.Header
	Body   []byte
	// contains filtered or unexported fields
}

func (*Part) AddChild

func (p *Part) AddChild(child *Part)

func (*Part) Child

func (p *Part) Child(n int) (part *Part, err error)

func (*Part) Children

func (p *Part) Children() Parts

func (*Part) ContentDisposition added in v3.7.0

func (p *Part) ContentDisposition() (string, map[string]string, error)

func (*Part) ContentType

func (p *Part) ContentType() (string, map[string]string, error)

func (*Part) ConvertMetaCharset

func (p *Part) ConvertMetaCharset() error

func (*Part) ConvertToUTF8

func (p *Part) ConvertToUTF8() error

func (*Part) HasContentID added in v3.7.0

func (p *Part) HasContentID() bool

func (*Part) InsertChild added in v3.7.0

func (p *Part) InsertChild(index int, child *Part)

func (*Part) IsAttachment added in v3.7.1

func (p *Part) IsAttachment() bool

type Parts

type Parts []*Part

type Visit

type Visit func(*Part) (interface{}, error)

type Visitor

type Visitor struct {
	// contains filtered or unexported fields
}

func (*Visitor) RegisterRule

func (v *Visitor) RegisterRule(contentTypeRegex string, fn VisitorRule) *Visitor

RegisterRule defines what to do when visiting a part whose content type matches the given regular expression. If a part matches multiple rules, the one registered first will be used.

func (*Visitor) Visit

func (v *Visitor) Visit() (interface{}, error)

type VisitorRule

type VisitorRule func(*Part, Visit) (interface{}, error)

type Walker

type Walker struct {
	// contains filtered or unexported fields
}

func (*Walker) RegisterContentDispositionHandler

func (w *Walker) RegisterContentDispositionHandler(dispRegExp string, fn HandlerFunc) *Walker

RegisterContentDispositionHandler registers a handler that will be called when a part's content disposition matches the given regular expression. If a part matches multiple handlers, the one registered first will be chosen.

func (*Walker) RegisterContentTypeHandler

func (w *Walker) RegisterContentTypeHandler(typeRegExp string, fn HandlerFunc) *Walker

RegisterContentTypeHandler registers a handler that will be called when a part's content type matches the given regular expression. If a part matches multiple handlers, the one registered first will be chosen.

func (*Walker) RegisterDefaultHandler

func (w *Walker) RegisterDefaultHandler(fn HandlerFunc) *Walker

RegisterDefaultHandler registers a handler that will be called on every part that doesn't match a registered content type/disposition handler.

func (*Walker) Walk

func (w *Walker) Walk() error

func (*Walker) WalkSkipAttachment added in v3.7.0

func (w *Walker) WalkSkipAttachment() error

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func (*Writer) Write

func (w *Writer) Write(ww io.Writer) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL