Documentation ¶
Index ¶
- type Config
- type Diff
- type Email
- type EmailDiff
- type FullEmail
- type Mailbox
- type MailboxDiff
- type State
- func (s *State) AddFlag(dir string, f maildir.Flag, ref *Email)
- func (s *State) CreateEmail(dir string, eml *Email)
- func (s *State) CreateMailbox(mbox *Mailbox)
- func (s *State) DeleteEmail(dir string, ref *Email)
- func (s *State) DeleteMailbox(mbox *Mailbox)
- func (s *State) Load() error
- func (s *State) MailboxByLocalName(name string) (*Mailbox, bool)
- func (s *State) RemoveFlag(dir string, flag maildir.Flag, ref *Email)
- func (s *State) RenameMailbox(orig string, dest *Mailbox)
- func (s *State) Save() error
- func (s *State) UpdateMailboxState(name string, modseq uint64, uidnext uint32)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Name string Maildir string `toml:"maildir"` Host string `toml:"host"` Username string `toml:"username"` Password string `toml:"password"` PasswordCmd string `toml:"password-cmd"` AuthMech string `toml:"auth-mech"` MaxConnections int `toml:"max-connections"` }
func LoadConfig ¶
type Diff ¶
type Diff struct { Mailboxes *MailboxDiff // Emails is a map of EmailDiffs to mailbox name. The key will always be // in reference to the local name, ("/" as a delimiter) Emails map[string]*EmailDiff FetchFunc func(string, []*Email) chan *FullEmail }
Diff represents the changes to the store state since last sync
type Email ¶
type Email struct { // The UID of the email UID uint32 `json:"u"` // The Maildir Key of the email Key string `json:"k"` // The current flags on the email Flags []maildir.Flag `json:"f"` // The UIDValidity of the mailbox the email belongs to UIDValidity uint32 `json:"m"` // Mailbox *Mailbox `json:"-"` // Date is the best known time for the email creation Date time.Time `json:"-"` // contains filtered or unexported fields }
Email is the internal representation of an email's state
func (*Email) SetFilename ¶
type EmailDiff ¶
type EmailDiff struct { Created []*Email Deleted []*Email FlagAdded map[maildir.Flag][]*Email FlagRemoved map[maildir.Flag][]*Email }
func CompareEmails ¶
CompareEmails compares state of emails for a mailbox pair and adds them to the appropriate changes category. The passed maps are a map of <key> or <uid>, both as strings.
func NewEmailDiff ¶
func NewEmailDiff() *EmailDiff
type Mailbox ¶
type Mailbox struct { // The UIDValidity of the mailbox UIDValidity uint32 `json:"uidvalidity"` // LocalName is the relative path of the maildir LocalName string `json:"localName"` // RemoteName is the name of the mailbox on the remote IMAP. It could // have different delimiters than filepath ("/") RemoteName string `json:"remoteName"` // The emails in the mailbox Emails []*Email `json:"emails"` // UIDNext is the next UID in the mailbox. This is only used in certain // sync scenarios UIDNext uint32 `json:"uidNext,omitempty"` // HighestModSeq is the highest mod seq reported by the server for this // mailbox. It is only used in certain sync scenarios HighestModSeq uint64 `json:"modseq,omitempty"` // If the mailbox is already synched. Synched bool `json:"-"` }
Mailbox is the internal representation of a mailbox state
func NewMailbox ¶
NewMailbox creates a new Mailbox object
type MailboxDiff ¶
type MailboxDiff struct { // Mailboxes created since last sync Created []*Mailbox // Mailboxes renamed since last sync. The key will always be in // reference to the local name, ("/" as a delimiter), and is the old // name of the mailbox. Renamed map[string]*Mailbox // Mailboxes deleted since the last sync. These mailboxes are deleted // last Deleted []*Mailbox // UIDValidityChange are mailboxes whose names haven't changed, but // UIDvalidity has. These mailboxes are deleted before making sync // changes UIDValidityChange []*Mailbox }
func CompareMailboxes ¶
func CompareMailboxes(oldSt map[string]*Mailbox, newSt map[string]*Mailbox) *MailboxDiff
CompareMailboxes compares states of two maps of mailboxes and returns the diff. The maps are strings of the LocalName to the mailbox object
func NewMailboxDiff ¶
func NewMailboxDiff() *MailboxDiff
type State ¶
type State struct { // Mailboxes is a map of local mailbox ID to remote mailbox ID Mailboxes []*Mailbox `json:"mailboxes"` // contains filtered or unexported fields }
State is the application state. It manages the synchronization state
func (*State) CreateEmail ¶
CreateEmail creates an email in state for the LocalName passed in