upgrade deps; rewrite smtp session

This commit is contained in:
Aine
2024-02-19 22:55:14 +02:00
parent 10213cc7d7
commit a01720da00
277 changed files with 106832 additions and 7641 deletions

View File

@@ -27,3 +27,64 @@ type multipartWOBoundaryAsSinglePartOption bool
func (o multipartWOBoundaryAsSinglePartOption) apply(p *Parser) {
p.multipartWOBoundaryAsSinglePart = bool(o)
}
// SetReadPartErrorPolicy sets the given callback function to readPartErrorPolicy.
func SetReadPartErrorPolicy(f ReadPartErrorPolicy) Option {
return readPartErrorPolicyOption(f)
}
type readPartErrorPolicyOption ReadPartErrorPolicy
func (o readPartErrorPolicyOption) apply(p *Parser) {
p.readPartErrorPolicy = ReadPartErrorPolicy(o)
}
// MaxStoredPartErrors limits number of part parsing errors, errors beyond the limit are discarded.
// Zero, the default, means all errors will be kept.
func MaxStoredPartErrors(n int) Option {
return maxStoredPartErrorsOption(n)
}
type maxStoredPartErrorsOption int
func (o maxStoredPartErrorsOption) apply(p *Parser) {
max := int(o)
p.maxStoredPartErrors = &max
}
// RawContent if set to true will not try to decode the CTE and return the raw part content.
// Otherwise, will try to automatically decode the CTE.
func RawContent(a bool) Option {
return rawContentOption(a)
}
type rawContentOption bool
func (o rawContentOption) apply(p *Parser) {
p.rawContent = bool(o)
}
// SetCustomParseMediaType if provided, will be used to parse media type instead of the default ParseMediaType
// function. This may be used to parse media type parameters that would otherwise be considered malformed.
// By default parsing happens using ParseMediaType
func SetCustomParseMediaType(customParseMediaType CustomParseMediaType) Option {
return parseMediaTypeOption(customParseMediaType)
}
type parseMediaTypeOption CustomParseMediaType
func (o parseMediaTypeOption) apply(p *Parser) {
p.customParseMediaType = CustomParseMediaType(o)
}
type stripMediaTypeInvalidCharactersOption bool
func (o stripMediaTypeInvalidCharactersOption) apply(p *Parser) {
p.stripMediaTypeInvalidCharacters = bool(o)
}
// StripMediaTypeInvalidCharacters sets stripMediaTypeInvalidCharacters option. If true, invalid characters
// will be removed from media type during parsing.
func StripMediaTypeInvalidCharacters(stripMediaTypeInvalidCharacters bool) Option {
return stripMediaTypeInvalidCharactersOption(stripMediaTypeInvalidCharacters)
}