tequat

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package tequat implements parsing of mail messages into categories of "Text, Quotes, Attachment".

Index

Constants

This section is empty.

Variables

View Source
var ErrMIMEAlienMediatypeParameters = errors.New("MIME alien media type parameters")
View Source
var ErrMIMENotYetImplemented = errors.New("MIME not yet implemented")
View Source
var ErrMIMESemantics = errors.New("MIME semantics")
View Source
var ErrMIMEUnknownMediaType = errors.New("MIME unknown media type")

Functions

func GetUnique

func GetUnique(header textproto.MIMEHeader, key string) string

func Highlight

func Highlight(mark string) string

Types

type Atom

type Atom interface {
	// contains filtered or unexported methods
}

type Attachment

type Attachment struct {
	Inline bool

	// Header should contain a singular, non-empty value keyed "Content-Type".
	// Header may be nil.
	Header textproto.MIMEHeader

	Data []byte
}

func (Attachment) ContentType

func (attachment Attachment) ContentType() string

func (Attachment) Ext

func (attachment Attachment) Ext() string

may be empty TODO This is not the whole story. (See: "Content-Type: application/pdf; name=..." or "Content-Disposition: attachment; filename=...")

type AttachmentStore

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

func NewAttachmentStore

func NewAttachmentStore() *AttachmentStore

func (*AttachmentStore) Get

func (as *AttachmentStore) Get(asid AttachmentStoreID) (contenttype string, r io.Reader, ok bool)

func (*AttachmentStore) Put

func (as *AttachmentStore) Put(attachment Attachment) (AttachmentStoreID, error)

type AttachmentStoreID

type AttachmentStoreID string

type DroppedAlternatives

type DroppedAlternatives struct {
	MediatypeTs []string
}

type Quote

type Quote struct {
	Raw string
}

type SignatureBlock

type SignatureBlock struct {
	// leading "-- \n" is stripped
	Raw string
}

type TQA

type TQA []Atom

"Text, Quotes, Attachments"

func Parse

func Parse(header textproto.MIMEHeader, r io.Reader) (TQA, error)

func ParseRaw

func ParseRaw(rawmsgr io.Reader) ([]mailx.Field, TQA, error)

TODO inelegantly implemented? [2023-07-23, jfrech] TODO Inelegantly named!

func (TQA) Attachments

func (tqa TQA) Attachments() (attachments []Attachment)

func (TQA) Format

func (tqa TQA) Format() string

func (TQA) Normalised

func (tqa TQA) Normalised() TQA

Normalised is pure.

type Text

type Text struct {
	Raw string
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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