imap

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttrNoSelect    = `\Noselect`
	AttrNoInferiors = `\Noinferiors`
	AttrMarked      = `\Marked`
	AttrUnmarked    = `\Unmarked`

	// Special Use attributes as defined in RFC-6154.
	AttrAll     = `\All`
	AttrArchive = `\Archive`
	AttrDrafts  = `\Drafts`
	AttrFlagged = `\Flagged`
	AttrJunk    = `\Junk`
	AttrSent    = `\Sent`
	AttrTrash   = `\Trash`
)
View Source
const (
	FlagSeen     = `\Seen`
	FlagAnswered = `\Answered`
	FlagFlagged  = `\Flagged`
	FlagDeleted  = `\Deleted`
	FlagDraft    = `\Draft`
	FlagRecent   = `\Recent` // Read-only!.
)
View Source
const (
	FlagSeenLowerCase     = `\seen`
	FlagAnsweredLowerCase = `\answered`
	FlagFlaggedLowerCase  = `\flagged`
	FlagDeletedLowerCase  = `\deleted`
	FlagDraftLowerCase    = `\draft`
	FlagRecentLowerCase   = `\recent` // Read-only!.
)
View Source
const (
	IDKeyName             = "name"
	IDKeyVersion          = "version"
	IDKeyOS               = "os"
	IdKeyOSVersion        = "os-version"
	IDKeyVendor           = "vendor"
	IDKeySupportURL       = "support-url"
	IDKeyAddress          = "address"
	IDKeyDate             = "date"
	IDKeyCommand          = "command"
	IDKeyArguments        = "arguments"
	IDKeyEnvironment      = "environment"
	IMAPIDConnMetadataKey = "rfc2971-id"
)
View Source
const (
	StatusMessages    = `MESSAGES`
	StatusRecent      = `RECENT`
	StatusUIDNext     = `UIDNEXT`
	StatusUIDValidity = `UIDVALIDITY`
	StatusUnseen      = `UNSEEN`
)
View Source
const Inbox = "INBOX"

Variables

This section is empty.

Functions

func Envelope

func Envelope(header *rfc822.Header) (string, error)

func IsCapabilityAvailableBeforeAuth added in v0.12.0

func IsCapabilityAvailableBeforeAuth(c Capability) bool

func NewContextWithIMAPID added in v0.8.0

func NewContextWithIMAPID(ctx context.Context, id IMAPID) context.Context

func Structure

func Structure(section *rfc822.Section) (string, string, error)

Types

type Capability

type Capability string
const (
	IMAP4rev1 Capability = `IMAP4rev1`
	StartTLS  Capability = `STARTTLS`
	IDLE      Capability = `IDLE`
	UNSELECT  Capability = `UNSELECT`
	UIDPLUS   Capability = `UIDPLUS`
	MOVE      Capability = `MOVE`
)

type Field

type Field struct {
	Key, Value string
}

type FlagSet

type FlagSet map[string]string

FlagSet represents a set of IMAP flags. Flags are case-insensitive and no duplicates are allowed.

func NewFlagSet

func NewFlagSet(flags ...string) FlagSet

NewFlagSet creates a flag set containing the specified flags.

func NewFlagSetFromSlice

func NewFlagSetFromSlice(flags []string) FlagSet

NewFlagSetFromSlice creates a flag set containing the flags from a slice.

func NewFlagSetWithCapacity added in v0.12.0

func NewFlagSetWithCapacity(capacity int) FlagSet

func (FlagSet) Add

func (fs FlagSet) Add(flags ...string) FlagSet

Add adds new flags to the flag set. The function returns false iff no flags was actually added because they're already in the set. The case of existing elements is preserved.

func (FlagSet) AddFlagSet

func (fs FlagSet) AddFlagSet(set FlagSet) FlagSet

func (FlagSet) AddFlagSetToSelf added in v0.12.0

func (fs FlagSet) AddFlagSetToSelf(set FlagSet)

func (FlagSet) AddToSelf added in v0.12.0

func (fs FlagSet) AddToSelf(flags ...string)

func (FlagSet) Clone added in v0.12.0

func (fs FlagSet) Clone() FlagSet

Clone creates a hard copy of the flag set.

func (FlagSet) Contains

func (fs FlagSet) Contains(flag string) bool

Contains returns true if and only if the flag is in the set.

func (FlagSet) ContainsAll

func (fs FlagSet) ContainsAll(flags ...string) bool

ContainsAll returns true if and only if all of the flags are in the set.

func (FlagSet) ContainsAny

func (fs FlagSet) ContainsAny(flags ...string) bool

ContainsAny returns true if and only if any of the flags are in the set.

func (FlagSet) ContainsUnchecked added in v0.12.0

func (fs FlagSet) ContainsUnchecked(flag string) bool

ContainsUnchecked returns true if and only if the flag is in the set. The flag is not converted to lower case. This is useful for cases where we need to check flags in bulk.

func (FlagSet) Equals

func (fs FlagSet) Equals(otherFs FlagSet) bool

Equals returns true if and only if the two sets are equal (same number of elements and each element of fs is also in otherFs).

func (FlagSet) Len

func (fs FlagSet) Len() int

Len returns the number of flags in the flag set.

func (FlagSet) Remove

func (fs FlagSet) Remove(flags ...string) FlagSet

func (FlagSet) RemoveFlagSet

func (fs FlagSet) RemoveFlagSet(set FlagSet) FlagSet

func (FlagSet) RemoveFlagSetFromSelf added in v0.12.0

func (fs FlagSet) RemoveFlagSetFromSelf(set FlagSet)

func (FlagSet) RemoveFromSelf added in v0.12.0

func (fs FlagSet) RemoveFromSelf(flags ...string)

func (FlagSet) Set

func (fs FlagSet) Set(flag string, on bool) FlagSet

Set ensures the flagset either contains or does not contain the given flag.

func (FlagSet) SetOnSelf added in v0.12.0

func (fs FlagSet) SetOnSelf(flag string, on bool)

SetOnSelf ensures the flagset either contains or does not contain the given flag.

func (FlagSet) ToSlice

func (fs FlagSet) ToSlice() []string

ToSlice Returns the list of flags in the set as a sorted string slice. The returned list is a hard copy of the internal slice to avoid direct modifications of the FlagSet value that would break the uniqueness and case insensitivity rules.

type Header []Field

type IMAPID added in v0.12.0

type IMAPID struct {
	Name        string
	Version     string
	OS          string
	OSVersion   string
	Vendor      string
	SupportURL  string
	Address     string
	Date        string
	Command     string
	Arguments   string
	Environment string
	Other       map[string]string
}

IMAPID represents the RFC 2971 IMAP IMAPID Extension. This information can be retrieved by the connector at the context level. To do so please use the provided GetIMAPIDFromContext() function.

func GetIMAPIDFromContext added in v0.8.0

func GetIMAPIDFromContext(ctx context.Context) (IMAPID, bool)

func NewIMAPID added in v0.12.0

func NewIMAPID() IMAPID

func NewIMAPIDFromKeyMap added in v0.8.0

func NewIMAPIDFromKeyMap(m map[string]string) IMAPID

func NewIMAPIDFromVersionInfo added in v0.8.0

func NewIMAPIDFromVersionInfo(info version.Info) IMAPID

func (*IMAPID) String added in v0.12.0

func (id *IMAPID) String() string

type InternalMailboxID added in v0.11.0

type InternalMailboxID uint64

func (InternalMailboxID) ShortID added in v0.11.0

func (i InternalMailboxID) ShortID() string

func (InternalMailboxID) String added in v0.12.0

func (i InternalMailboxID) String() string

type InternalMessageID added in v0.11.0

type InternalMessageID uint64

func InternalMessageIDFromString added in v0.12.0

func InternalMessageIDFromString(id string) (InternalMessageID, error)

func (InternalMessageID) ShortID added in v0.11.0

func (i InternalMessageID) ShortID() string

func (InternalMessageID) String added in v0.12.0

func (i InternalMessageID) String() string

func (InternalMessageID) ToBytes added in v0.12.0

func (i InternalMessageID) ToBytes() []byte

type Mailbox

type Mailbox struct {
	ID MailboxID

	Name []string

	Flags, PermanentFlags, Attributes FlagSet
}

type MailboxCreated

type MailboxCreated struct {
	Mailbox Mailbox
	// contains filtered or unexported fields
}

func NewMailboxCreated

func NewMailboxCreated(mailbox Mailbox) *MailboxCreated

func (MailboxCreated) Done

func (w MailboxCreated) Done()

func (*MailboxCreated) String

func (u *MailboxCreated) String() string

func (MailboxCreated) Wait

func (w MailboxCreated) Wait()

func (MailboxCreated) WaitContext added in v0.12.0

func (w MailboxCreated) WaitContext(ctx context.Context)

type MailboxDeleted

type MailboxDeleted struct {
	MailboxID MailboxID
	// contains filtered or unexported fields
}

func NewMailboxDeleted

func NewMailboxDeleted(mailboxID MailboxID) *MailboxDeleted

func (MailboxDeleted) Done

func (w MailboxDeleted) Done()

func (*MailboxDeleted) String

func (u *MailboxDeleted) String() string

func (MailboxDeleted) Wait

func (w MailboxDeleted) Wait()

func (MailboxDeleted) WaitContext added in v0.12.0

func (w MailboxDeleted) WaitContext(ctx context.Context)

type MailboxID added in v0.13.0

type MailboxID string

func (MailboxID) ShortID added in v0.13.0

func (l MailboxID) ShortID() string

type MailboxIDChanged

type MailboxIDChanged struct {
	InternalID InternalMailboxID
	RemoteID   MailboxID
	// contains filtered or unexported fields
}

func NewMailboxIDChanged

func NewMailboxIDChanged(internalID InternalMailboxID, remoteID MailboxID) *MailboxIDChanged

func (MailboxIDChanged) Done

func (w MailboxIDChanged) Done()

func (*MailboxIDChanged) String

func (u *MailboxIDChanged) String() string

func (MailboxIDChanged) Wait

func (w MailboxIDChanged) Wait()

func (MailboxIDChanged) WaitContext added in v0.12.0

func (w MailboxIDChanged) WaitContext(ctx context.Context)

type MailboxUpdated

type MailboxUpdated struct {
	MailboxID   MailboxID
	MailboxName []string
	// contains filtered or unexported fields
}

func NewMailboxUpdated

func NewMailboxUpdated(mailboxID MailboxID, mailboxName []string) *MailboxUpdated

func (MailboxUpdated) Done

func (w MailboxUpdated) Done()

func (*MailboxUpdated) String

func (u *MailboxUpdated) String() string

func (MailboxUpdated) Wait

func (w MailboxUpdated) Wait()

func (MailboxUpdated) WaitContext added in v0.12.0

func (w MailboxUpdated) WaitContext(ctx context.Context)

type Message

type Message struct {
	ID    MessageID
	Flags FlagSet
	Date  time.Time
}

func (*Message) HasFlag

func (m *Message) HasFlag(wantFlag string) bool

type MessageCreated

type MessageCreated struct {
	Message       Message
	Literal       []byte
	MailboxIDs    []MailboxID
	ParsedMessage *ParsedMessage
}

type MessageDeleted added in v0.8.1

type MessageDeleted struct {
	MessageID MessageID
	// contains filtered or unexported fields
}

func NewMessagesDeleted added in v0.8.1

func NewMessagesDeleted(messageID MessageID) *MessageDeleted

func (MessageDeleted) Done added in v0.8.1

func (w MessageDeleted) Done()

func (*MessageDeleted) String added in v0.8.1

func (u *MessageDeleted) String() string

func (MessageDeleted) Wait added in v0.8.1

func (w MessageDeleted) Wait()

func (MessageDeleted) WaitContext added in v0.12.0

func (w MessageDeleted) WaitContext(ctx context.Context)

type MessageFlagsUpdated added in v0.12.0

type MessageFlagsUpdated struct {
	MessageID     MessageID
	Seen, Flagged bool
	// contains filtered or unexported fields
}

func NewMessageFlagsUpdated added in v0.12.0

func NewMessageFlagsUpdated(messageID MessageID, seen, flagged bool) *MessageFlagsUpdated

func (MessageFlagsUpdated) Done added in v0.12.0

func (w MessageFlagsUpdated) Done()

func (*MessageFlagsUpdated) String added in v0.12.0

func (u *MessageFlagsUpdated) String() string

func (MessageFlagsUpdated) Wait added in v0.12.0

func (w MessageFlagsUpdated) Wait()

func (MessageFlagsUpdated) WaitContext added in v0.12.0

func (w MessageFlagsUpdated) WaitContext(ctx context.Context)

type MessageID added in v0.11.0

type MessageID string

func (MessageID) ShortID added in v0.11.0

func (m MessageID) ShortID() string

type MessageIDChanged

type MessageIDChanged struct {
	InternalID InternalMessageID
	RemoteID   MessageID
	// contains filtered or unexported fields
}

func NewMessageIDChanged

func NewMessageIDChanged(internalID InternalMessageID, remoteID MessageID) *MessageIDChanged

func (MessageIDChanged) Done

func (w MessageIDChanged) Done()

func (*MessageIDChanged) String

func (u *MessageIDChanged) String() string

func (MessageIDChanged) Wait

func (w MessageIDChanged) Wait()

func (MessageIDChanged) WaitContext added in v0.12.0

func (w MessageIDChanged) WaitContext(ctx context.Context)

type MessageMailboxesUpdated added in v0.13.0

type MessageMailboxesUpdated struct {
	MessageID     MessageID
	MailboxIDs    []MailboxID
	Seen, Flagged bool
	// contains filtered or unexported fields
}

func NewMessageMailboxesUpdated added in v0.13.0

func NewMessageMailboxesUpdated(messageID MessageID, mailboxIDs []MailboxID, seen, flagged bool) *MessageMailboxesUpdated

func (MessageMailboxesUpdated) Done added in v0.13.0

func (w MessageMailboxesUpdated) Done()

func (*MessageMailboxesUpdated) String added in v0.13.0

func (u *MessageMailboxesUpdated) String() string

func (MessageMailboxesUpdated) Wait added in v0.13.0

func (w MessageMailboxesUpdated) Wait()

func (MessageMailboxesUpdated) WaitContext added in v0.13.0

func (w MessageMailboxesUpdated) WaitContext(ctx context.Context)

type MessageUpdated

type MessageUpdated struct {
	Message       Message
	Literal       []byte
	MailboxIDs    []MailboxID
	ParsedMessage *ParsedMessage
	// contains filtered or unexported fields
}

MessageUpdated replaces the previous behavior of MessageDelete followed by MessageCreate. Furthermore, it guarantees that the operation is executed atomically.

func NewMessageUpdated

func NewMessageUpdated(message Message, literal []byte, mailboxIDs []MailboxID, parsedMessage *ParsedMessage) *MessageUpdated

func (MessageUpdated) Done

func (w MessageUpdated) Done()

func (*MessageUpdated) String

func (u *MessageUpdated) String() string

func (MessageUpdated) Wait

func (w MessageUpdated) Wait()

func (MessageUpdated) WaitContext added in v0.14.0

func (w MessageUpdated) WaitContext(ctx context.Context)

type MessagesCreated added in v0.7.0

type MessagesCreated struct {
	Messages []*MessageCreated
	// contains filtered or unexported fields
}

func NewMessagesCreated added in v0.7.0

func NewMessagesCreated(updates ...*MessageCreated) *MessagesCreated

func (MessagesCreated) Done added in v0.7.0

func (w MessagesCreated) Done()

func (*MessagesCreated) String added in v0.7.0

func (u *MessagesCreated) String() string

func (MessagesCreated) Wait added in v0.7.0

func (w MessagesCreated) Wait()

func (MessagesCreated) WaitContext added in v0.12.0

func (w MessagesCreated) WaitContext(ctx context.Context)

type Noop added in v0.12.0

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

func NewNoop added in v0.12.0

func NewNoop() *Noop

func (Noop) Done added in v0.12.0

func (w Noop) Done()

func (*Noop) String added in v0.12.0

func (u *Noop) String() string

func (Noop) Wait added in v0.12.0

func (w Noop) Wait()

func (Noop) WaitContext added in v0.12.0

func (w Noop) WaitContext(ctx context.Context)

type ParsedMessage added in v0.12.0

type ParsedMessage struct {
	Body      string
	Structure string
	Envelope  string
}

func NewParsedMessage added in v0.12.0

func NewParsedMessage(literal []byte) (*ParsedMessage, error)

type SeqID added in v0.12.0

type SeqID uint32

type SeqSet

type SeqSet []SeqVal

func NewSeqSet

func NewSeqSet(set []SeqID) SeqSet

func NewSeqSetFromUID added in v0.12.0

func NewSeqSetFromUID(set []UID) SeqSet

func (SeqSet) String

func (set SeqSet) String() string

type SeqVal

type SeqVal struct {
	Begin, End SeqID
}

func (SeqVal) String

func (seqval SeqVal) String() string

type UID added in v0.12.0

type UID uint32

func (UID) Add added in v0.12.0

func (u UID) Add(v uint32) UID

type UIDValidityBumped added in v0.14.0

type UIDValidityBumped struct {
	UIDValidity UID
	// contains filtered or unexported fields
}

func NewUIDValidityBumped added in v0.14.0

func NewUIDValidityBumped(validity UID) *UIDValidityBumped

func (UIDValidityBumped) Done added in v0.14.0

func (w UIDValidityBumped) Done()

func (*UIDValidityBumped) String added in v0.14.0

func (u *UIDValidityBumped) String() string

func (UIDValidityBumped) Wait added in v0.14.0

func (w UIDValidityBumped) Wait()

func (UIDValidityBumped) WaitContext added in v0.14.0

func (w UIDValidityBumped) WaitContext(ctx context.Context)

type Update

type Update interface {
	Waiter

	String() string
	// contains filtered or unexported methods
}

type Waiter

type Waiter interface {
	// Wait waits until the update has been marked as done.
	Wait()

	// WaitContext waits until the update has been marked as done or the context is cancelled.
	WaitContext(context.Context)

	// Done marks the update as done.
	Done()
}

Jump to

Keyboard shortcuts

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