Documentation ¶
Index ¶
- Constants
- Variables
- func MarshalEnvelope(m *Message) string
- func MarshalFlags(m *Message) string
- func MarshalInternalDate(m *Message) string
- func MarshalRFC822(m *Message) string
- func MarshalRFC822Header(m *Message) string
- func MarshalRFC822Size(m *Message) string
- func MarshalRFC822Text(m *Message) string
- func MarshalUID(m *Message) string
- type AllTerm
- type BasicFetchAttribute
- type BodyFetchAttribute
- type BodystructureFetchAttribute
- type BooleanTerm
- type Conn
- func (c *Conn) Bad(r *Request, err error)
- func (c *Conn) Close() error
- func (c *Conn) Continuation(msg string)
- func (c *Conn) DiscardLine()
- func (c *Conn) No(r *Request, err error)
- func (c *Conn) Ok(r *Request)
- func (c *Conn) OkWithCode(r *Request, responseCode string)
- func (c *Conn) ReadRequest() (*Request, error)
- func (c *Conn) Splat(msg string)
- func (c *Conn) Write(b []byte) (int, error)
- type DateTerm
- type FetchAttribute
- type Field
- type Flag
- type FlagTerm
- type IntTerm
- type Message
- type Op
- type Parser
- func (p *Parser) DiscardLine()
- func (p *Parser) Err() error
- func (p *Parser) Expect(s string)
- func (p *Parser) Peek() byte
- func (p *Parser) ReadAstring() string
- func (p *Parser) ReadAtom() string
- func (p *Parser) ReadAtomList() []string
- func (p *Parser) ReadAtomWithExtra(extra map[byte]bool) string
- func (p *Parser) ReadBodyAttribute() *BodyFetchAttribute
- func (p *Parser) ReadDate() time.Time
- func (p *Parser) ReadDateTime() time.Time
- func (p *Parser) ReadEOL()
- func (p *Parser) ReadFetchAttribute() FetchAttribute
- func (p *Parser) ReadFetchAttributeList() []FetchAttribute
- func (p *Parser) ReadFetchAttributes() []FetchAttribute
- func (p *Parser) ReadFlagList() []Flag
- func (p *Parser) ReadInt() int
- func (p *Parser) ReadList(tokenReader func() string) []string
- func (p *Parser) ReadListEnd()
- func (p *Parser) ReadListMailbox() string
- func (p *Parser) ReadListStart()
- func (p *Parser) ReadLiteral() string
- func (p *Parser) ReadLiteralPrefix() (size int, sync bool)
- func (p *Parser) ReadLiteralStream() io.Reader
- func (p *Parser) ReadQuotedString() string
- func (p *Parser) ReadSearch() (charset string, query Term)
- func (p *Parser) ReadSearchKey() Term
- func (p *Parser) ReadSequenceSet() *SequenceSet
- func (p *Parser) ReadSpace()
- func (p *Parser) ReadString() string
- func (p *Parser) ReadStringWithExtra(extra map[byte]bool) string
- func (p *Parser) String() string
- func (p *Parser) Tail() string
- func (p *Parser) Valid() bool
- type ProtocolError
- type Reader
- type Request
- type SequenceRange
- type SequenceSet
- type SetTerm
- type StringTerm
- type Term
- type TermVisitor
- type UnaryTerm
- type Writer
Constants ¶
View Source
const ( FetchAll bodyFetchMode = "" FetchText = "TEXT" FetchHeader = "HEADER" FetchHeaderFields = "HEADER.FIELDS" FetchHeaderFieldsNot = "HEADER.FIELDS.NOT" )
View Source
const ( FlagAnswered Flag = `\Answered` FlagFlagged = `\Flagged` FlagDeleted = `\Trashed` FlagSeen = `\Seen` FlagDraft = `\Draft` FlagRecent = `\Recent` KeywordMDNSent Flag = `$MDNSent` KeywordForwarded = `$Forwarded` KeywordSubmitPending = `$SubmitPending` KeywordSubmitted = `$Submitted` )
View Source
const ( FromField Field = "From" ToField = "To" CcField = "Cc" BccField = "Bcc" SubjectField = "Subject" TextField = "Text" BodyField = "Body" MSNField = "MSN" UIDField = "UID" SizeField = "Size" DateField = "Date" InternalDateField = "InternalDate" )
View Source
const Star = -1
Sentinel for IMAP '*'
Variables ¶
View Source
var ( EnvelopeFetchAttribute = BasicFetchAttribute{"ENVELOPE", MarshalEnvelope} FlagsFetchAttribute = BasicFetchAttribute{"FLAGS", MarshalFlags} InternalDateFetchAttribute = BasicFetchAttribute{"INTERNALDATE", MarshalInternalDate} RFC822FetchAttribute = BasicFetchAttribute{"RFC822", MarshalRFC822} RFC822HeaderFetchAttribute = BasicFetchAttribute{"RFC822.HEADER", MarshalRFC822Header} RFC822SizeFetchAttribute = BasicFetchAttribute{"RFC822.SIZE", MarshalRFC822Size} RFC822TextFetchAttribute = BasicFetchAttribute{"RFC822.TEXT", MarshalRFC822Text} UIDFetchAttribute = BasicFetchAttribute{"UID", MarshalUID} )
View Source
var ( ErrTooLong = ProtocolError("token too long") ErrLineTooShort = ProtocolError("line too short") ErrNegativeAdvance = ProtocolError("negative advance count") ErrAdvanceTooFar = ProtocolError("advance count beyond input") ErrSeqNoOutOfBounds = ProtocolError("sequence number out of bounds") )
View Source
var KnownFlags = []Flag{ FlagAnswered, FlagFlagged, FlagDeleted, FlagSeen, FlagDraft, FlagRecent, KeywordMDNSent, KeywordForwarded, KeywordSubmitPending, KeywordSubmitted, }
Functions ¶
func MarshalEnvelope ¶
func MarshalFlags ¶
func MarshalInternalDate ¶
func MarshalRFC822 ¶
func MarshalRFC822Header ¶
func MarshalRFC822Size ¶
func MarshalRFC822Text ¶
func MarshalUID ¶
Types ¶
type AllTerm ¶
type AllTerm struct{}
func (*AllTerm) Accept ¶
func (t *AllTerm) Accept(v TermVisitor)
type BasicFetchAttribute ¶
type BasicFetchAttribute struct {
// contains filtered or unexported fields
}
func (BasicFetchAttribute) Marshal ¶
func (fa BasicFetchAttribute) Marshal(m *Message) string
func (BasicFetchAttribute) Name ¶
func (fa BasicFetchAttribute) Name() string
type BodyFetchAttribute ¶
type BodyFetchAttribute struct {
// contains filtered or unexported fields
}
func (BodyFetchAttribute) Marshal ¶
func (fa BodyFetchAttribute) Marshal(msg *Message) string
func (BodyFetchAttribute) Name ¶
func (fa BodyFetchAttribute) Name() string
type BodystructureFetchAttribute ¶
type BodystructureFetchAttribute bool
func (BodystructureFetchAttribute) Marshal ¶
func (includeExtensions BodystructureFetchAttribute) Marshal(msg *Message) string
func (BodystructureFetchAttribute) Name ¶
func (includeExtensions BodystructureFetchAttribute) Name() string
type BooleanTerm ¶
func (*BooleanTerm) Accept ¶
func (t *BooleanTerm) Accept(v TermVisitor)
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func NewConn ¶
func NewConn(rwc io.ReadWriteCloser) *Conn
func (*Conn) Continuation ¶
func (*Conn) DiscardLine ¶
func (c *Conn) DiscardLine()
func (*Conn) OkWithCode ¶
func (*Conn) ReadRequest ¶
type FetchAttribute ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func (*Parser) DiscardLine ¶
func (p *Parser) DiscardLine()
func (*Parser) ReadAstring ¶
func (*Parser) ReadAtomList ¶
func (*Parser) ReadBodyAttribute ¶
func (p *Parser) ReadBodyAttribute() *BodyFetchAttribute
func (*Parser) ReadDateTime ¶
func (*Parser) ReadFetchAttribute ¶
func (p *Parser) ReadFetchAttribute() FetchAttribute
func (*Parser) ReadFetchAttributeList ¶
func (p *Parser) ReadFetchAttributeList() []FetchAttribute
NOTE: It's usually an error for the client to send a zero-item list. This method doesn't treat that as an error, but maybe should.
func (*Parser) ReadFetchAttributes ¶
func (p *Parser) ReadFetchAttributes() []FetchAttribute
func (*Parser) ReadFlagList ¶
func (*Parser) ReadList ¶
NOTE: It's usually an error for the client to send a zero-item list. This method doesn't treat that as an error, but maybe should.
func (*Parser) ReadListEnd ¶
func (p *Parser) ReadListEnd()
func (*Parser) ReadListMailbox ¶
func (*Parser) ReadListStart ¶
func (p *Parser) ReadListStart()
func (*Parser) ReadLiteral ¶
func (*Parser) ReadLiteralPrefix ¶
func (*Parser) ReadLiteralStream ¶
func (*Parser) ReadQuotedString ¶
func (*Parser) ReadSearch ¶
func (*Parser) ReadSearchKey ¶
Deviates from RFC3501 somewhat: * BODY and TEXT both perform general text searches * Handling of "ALL" is not super strict
func (*Parser) ReadSequenceSet ¶
func (p *Parser) ReadSequenceSet() *SequenceSet
func (*Parser) ReadString ¶
func (*Parser) ReadStringWithExtra ¶
type ProtocolError ¶
type ProtocolError string
func InvalidTokenError ¶
func InvalidTokenError(tokenType string, determinant byte, context string) ProtocolError
func ProtocolErrorf ¶
func ProtocolErrorf(format string, a ...interface{}) ProtocolError
func TypeMismatchError ¶
func TypeMismatchError(expected string, context string) ProtocolError
func (ProtocolError) Error ¶
func (e ProtocolError) Error() string
type SequenceRange ¶
type SequenceRange [2]int
func (*SequenceRange) Len ¶
func (r *SequenceRange) Len() int
func (*SequenceRange) Max ¶
func (r *SequenceRange) Max() int
func (*SequenceRange) Min ¶
func (r *SequenceRange) Min() int
func (*SequenceRange) String ¶
func (r *SequenceRange) String() string
type SequenceSet ¶
type SequenceSet struct {
// contains filtered or unexported fields
}
func NewSequenceSetWithRange ¶
func NewSequenceSetWithRange(rng SequenceRange) *SequenceSet
func (*SequenceSet) Append ¶
func (s *SequenceSet) Append(rng SequenceRange)
func (*SequenceSet) Foreach ¶
func (s *SequenceSet) Foreach(max int, callback func(int) error) error
func (*SequenceSet) Len ¶
func (s *SequenceSet) Len() int
func (*SequenceSet) Max ¶
func (s *SequenceSet) Max() int
func (*SequenceSet) String ¶
func (s *SequenceSet) String() string
type SetTerm ¶
type SetTerm struct { Op Op Field Field Set *SequenceSet }
func (*SetTerm) Accept ¶
func (t *SetTerm) Accept(v TermVisitor)
type StringTerm ¶
func (*StringTerm) Accept ¶
func (t *StringTerm) Accept(v TermVisitor)
type Term ¶
type Term interface {
Accept(TermVisitor)
}
type TermVisitor ¶
type TermVisitor interface { VisitAllTerm(*AllTerm) VisitBooleanTerm(*BooleanTerm) VisitDateTerm(*DateTerm) VisitFlagTerm(*FlagTerm) VisitIntTerm(*IntTerm) VisitSetTerm(*SetTerm) VisitStringTerm(*StringTerm) VisitUnaryTerm(*UnaryTerm) }
Click to show internal directories.
Click to hide internal directories.