gmime

package
v0.0.0-...-451b5b5 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package gmime implements the MIME, port of C GMime

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignJanitor

func AssignJanitor(self Janitor)

func CastContentDisposition

func CastContentDisposition(c *C.GMimeContentDisposition) *aContentDisposition

func CastDataWrapper

func CastDataWrapper(dw *C.GMimeDataWrapper) *aDataWrapper

func CastMemStream

func CastMemStream(cms *C.GMimeStreamMem) *aMemStream

func CastMessage

func CastMessage(m *C.GMimeMessage) *aMessage

func CastObject

func CastObject(o *C.GMimeObject) *anObject

func CastPart

func CastPart(p *C.GMimePart) *aPart

func CastStream

func CastStream(cs *C.GMimeStream) *aStream

func NewContentDispositionFromString

func NewContentDispositionFromString(str string) *aContentDisposition

func Shutdown

func Shutdown()

This function really need only for valgrind

Types

type Address

type Address interface {
	Janitor
	Name() string
	SetName(string)
}

XXX The underlying type-unsafe C implementation is modeled here with a type-safe Object-Oriented design, which is a modified form of the Composite Design Pattern. Specifically, Address is the Component, Mailbox is the Leaf, and Group & AddressList co-operate to act as the Composite. SEE TestCompositeAddress.

func CastAddress

func CastAddress(ca *C.InternetAddress) Address

type AddressList

type AddressList interface {
	Janitor
	GetLength() int
	Clear()
	Add(Address) int
	Prepend(AddressList)
	Append(AddressList)
	Insert(Address, int)
	Remove(Address) bool
	RemoveAt(int) bool
	Contains(Address) bool
	IndexOf(Address) int
	GetAddress(int) Address
	SetAddress(Address, int)
	ToString(bool) string
	Walk(callback func(Address))
	Slice() []Address
}

func ParseString

func ParseString(str string) AddressList

type ContentDisposition

type ContentDisposition interface {
	Janitor
	Parametrized
	Disposition() string
	ToString(fold bool) string
	IsAttachment() bool
}

type ContentEncodingState

type ContentEncodingState interface {
	Outlen(inlen int) (outlen int)
	Step(in []byte) (out []byte)
	Flush(in []byte) (out []byte)
}

func NewContentDecoder

func NewContentDecoder(encoding string) ContentEncodingState

func NewContentEncoder

func NewContentEncoder(encoding string) ContentEncodingState

type ContentType

type ContentType interface {
	Janitor
	Parametrized
	ToString() string
	MediaType() string
	MediaSubtype() string
}

func CastContentType

func CastContentType(ct *C.GMimeContentType) ContentType

func NewContentType

func NewContentType(ctype string, csubtype string) ContentType

func NewContentTypeFromString

func NewContentTypeFromString(str string) ContentType

type DataWrapper

type DataWrapper interface {
	Janitor
	Encoding() string
	WriteToStream(stream Stream) uintptr
	Stream() Stream
}

func NewDataWrapper

func NewDataWrapper() DataWrapper

func NewDataWrapperWithStream

func NewDataWrapperWithStream(stream Stream, encoding string) DataWrapper

type GMimeParamsCallback

type GMimeParamsCallback func(name string, value string)

type Group

type Group interface {
	Address
	Members() AddressList
	SetMembers(AddressList)
	AddMember(Address) int
}

type GroupAddress

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

func CastGroupAddress

func CastGroupAddress(ga *C.InternetAddressGroup) *GroupAddress

func NewGroupAddress

func NewGroupAddress(name string) *GroupAddress

func (*GroupAddress) AddMember

func (group *GroupAddress) AddMember(newAddress Address) int

func (*GroupAddress) Members

func (group *GroupAddress) Members() AddressList

func (GroupAddress) Name

func (a GroupAddress) Name() string

func (*GroupAddress) SetMembers

func (group *GroupAddress) SetMembers(list AddressList)

func (GroupAddress) SetName

func (a GroupAddress) SetName(name string)

type HeaderIterator

type HeaderIterator interface {
	Janitor
	Name() string
	Value() string
	Next() bool
}

Very minimal interface, to inspection only

type InternetAddressList

type InternetAddressList struct {
	*PointerMixin
}

func CastInternetAddressList

func CastInternetAddressList(cList *C.InternetAddressList) *InternetAddressList

func NewAddressList

func NewAddressList() *InternetAddressList

func (*InternetAddressList) Add

func (l *InternetAddressList) Add(address Address) int

func (*InternetAddressList) Append

func (l *InternetAddressList) Append(newList AddressList)

func (*InternetAddressList) Clear

func (l *InternetAddressList) Clear()

func (*InternetAddressList) Contains

func (l *InternetAddressList) Contains(address Address) bool

func (*InternetAddressList) GetAddress

func (l *InternetAddressList) GetAddress(index int) Address

func (*InternetAddressList) GetLength

func (l *InternetAddressList) GetLength() int

func (*InternetAddressList) IndexOf

func (l *InternetAddressList) IndexOf(address Address) int

func (*InternetAddressList) Insert

func (l *InternetAddressList) Insert(address Address, index int)

func (*InternetAddressList) Prepend

func (l *InternetAddressList) Prepend(newList AddressList)

func (*InternetAddressList) Remove

func (l *InternetAddressList) Remove(address Address) bool

func (*InternetAddressList) RemoveAt

func (l *InternetAddressList) RemoveAt(index int) bool

func (*InternetAddressList) SetAddress

func (l *InternetAddressList) SetAddress(address Address, index int)

func (*InternetAddressList) Slice

func (l *InternetAddressList) Slice() []Address

func (*InternetAddressList) ToString

func (l *InternetAddressList) ToString(encode bool) string

func (*InternetAddressList) Walk

func (l *InternetAddressList) Walk(callback func(Address))

type Janitor

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

Janitor to clean up wasteful resources

type Mailbox

type Mailbox interface {
	Address
	Email() string
	SetEmail(string)
}

type MailboxAddress

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

func CastMailboxAddress

func CastMailboxAddress(ma *C.InternetAddressMailbox) *MailboxAddress

func NewMailboxAddress

func NewMailboxAddress(name string, email string) *MailboxAddress

func (*MailboxAddress) Email

func (a *MailboxAddress) Email() string

func (MailboxAddress) Name

func (a MailboxAddress) Name() string

func (*MailboxAddress) SetEmail

func (a *MailboxAddress) SetEmail(email string)

func (MailboxAddress) SetName

func (a MailboxAddress) SetName(name string)

type MemStream

type MemStream interface {
	Stream
	Bytes() []byte
}

func NewMemStream

func NewMemStream() MemStream

func NewMemStreamWithBuffer

func NewMemStreamWithBuffer(str string) MemStream

type Message

type Message interface {
	Object
	SetSubject(string)
	Subject() (string, bool)
	SetMessageId(string)
	MessageId() (string, bool)
	To() *InternetAddressList
	Cc() *InternetAddressList
	Bcc() *InternetAddressList
	AllRecipients() *InternetAddressList
	SetMimePart(Object)
	MimePart() Object
	Body() Object
}

func NewMessage

func NewMessage() Message

type MessagePart

type MessagePart interface {
	Object
	Message() Message
	SetMessage(message Message)
}

func CastMessagePart

func CastMessagePart(mp *C.GMimeMessagePart) MessagePart

func NewMessagePart

func NewMessagePart(subtype string) MessagePart

func NewMessagePartWithMessage

func NewMessagePartWithMessage(subtype string, message Message) MessagePart

type MessagePartial

type MessagePartial interface {
	Object
	Id() string
	Number() int
	Total() int
}

func CastMessagePartial

func CastMessagePartial(mp *C.GMimeMessagePartial) MessagePartial

func NewMessagePartial

func NewMessagePartial(id string, number int, total int) MessagePartial

type Multipart

type Multipart interface {
	Object
	AddPart(Object)
	Boundary() string
	GetPart(int) Object
	Count() int
	Clear()
	Walk(func(Object) error) error
}

func CastMultipart

func CastMultipart(mp *C.GMimeMultipart) Multipart

func NewMultipart

func NewMultipart() Multipart

func NewMultipartWithSubtype

func NewMultipartWithSubtype(subtype string) Multipart

type Object

type Object interface {
	Janitor
	ContentType() ContentType
	ContentID() (string, bool)
	Header(string) (string, bool)
	ToString() string
	ContentDisposition() ContentDisposition
	Headers() string
	WalkHeaders(cb func(string, string) error) error
}

func NewObject

func NewObject(contentType ContentType) Object

func NewObjectWithType

func NewObjectWithType(ctype string, csubtype string) Object

type Parametrized

type Parametrized interface {
	SetParameter(name, value string)
	Parameter(name string) string
	ForEachParam(callback GMimeParamsCallback)
}

type Parse

type Parse interface {
	To() string
	Subject() (string, bool)
	Bcc() string
	Cc() string
	Recipients() string
	MessageId() (string, bool)
	Text() (string, bool)
	Html() (string, bool)
	Attachment() map[string][]byte
	//	AttachmentReader() Reader
	Headers() string
	Header(string) (string, bool)
	Boundary() string
}

func NewParse

func NewParse(reader io.Reader) Parse

type Parser

type Parser interface {
	Janitor
	ConstructMessage() Message
	ConstructPart() Object
	Tell() int64
	Eos() bool
	SetScanFrom(bool)
}

func CastParser

func CastParser(p *C.GMimeParser) Parser

func NewParserWithStream

func NewParserWithStream(stream Stream) Parser

type Part

type Part interface {
	Object
	ContentObject() DataWrapper
	SetContentObject(DataWrapper)
	Filename() string
	Description() string
	ContentLocation() string
	ContentEncoding() string
}

func NewPart

func NewPart() Part

func NewPartWithType

func NewPartWithType(ctype string, csubtype string) Part

type PartIter

type PartIter interface {
	Current() Object
	HasNext() bool
	Next()
	GetPath() (string, bool)
}

func NewPartIter

func NewPartIter(message Message) PartIter

type PointerMixin

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

func CastPointer

func CastPointer(p C.gpointer) *PointerMixin

func NewPointer

func NewPointer(p C.gpointer) *PointerMixin

for newly allocated only

type Stream

type Stream interface {
	Janitor
	Read(int64) (int64, []byte)
	Write([]byte) int64
	WriteBlock([]byte, int64) int64
	Flush() int
	Close() int
	Eos() bool
	Reset() int
	Seek(int64, int) (int64, error)
	Tell() int64
	Length() int64
	SubStream(int64, int64) Stream
	SetBounds(int64, int64)
	WriteString(string) int64
	WriteToStream(Stream) int64
}

Jump to

Keyboard shortcuts

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