imapgw

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Delimiter = "/"

Delimiter for mailboxes

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Vault *vault.Vault
}

Backend will hold the Vault to use

func New

func New(v *vault.Vault) *Backend

New will create a new Backend

func (*Backend) Login

func (be *Backend) Login(_ *imap.ConnInfo, username, password string) (backend.User, error)

Login is called when logging in to IMAP. Any password is valid as long as the account is found in the vault

type Mailbox

type Mailbox struct {
	Subscribed bool
	Messages   []*Message
	// contains filtered or unexported fields
}

Mailbox to hold messages and other info

func (*Mailbox) Check

func (mbox *Mailbox) Check() error

Check the mailbox

func (*Mailbox) CopyMessages

func (mbox *Mailbox) CopyMessages(uid bool, seqset *imap.SeqSet, destName string) error

CopyMessages is not implemented yet

func (*Mailbox) CreateMessage

func (mbox *Mailbox) CreateMessage(flags []string, date time.Time, body imap.Literal) error

CreateMessage will create a new local message

func (*Mailbox) Expunge

func (mbox *Mailbox) Expunge() error

Expunge will delete a message

func (*Mailbox) Info

func (mbox *Mailbox) Info() (*imap.MailboxInfo, error)

Info from the mailbox

func (*Mailbox) ListMessages

func (mbox *Mailbox) ListMessages(uid bool, seqSet *imap.SeqSet, items []imap.FetchItem, ch chan<- *imap.Message) error

ListMessages of the mailbox

func (*Mailbox) Name

func (mbox *Mailbox) Name() string

Name of the mailbox

func (*Mailbox) SearchMessages

func (mbox *Mailbox) SearchMessages(uid bool, criteria *imap.SearchCriteria) ([]uint32, error)

SearchMessages in the mailbox

func (*Mailbox) SetSubscribed

func (mbox *Mailbox) SetSubscribed(subscribed bool) error

SetSubscribed will mark the mailbox as subscribed

func (*Mailbox) Status

func (mbox *Mailbox) Status(items []imap.StatusItem) (*imap.MailboxStatus, error)

Status of the mailbox

func (*Mailbox) UpdateMessagesFlags

func (mbox *Mailbox) UpdateMessagesFlags(uid bool, seqset *imap.SeqSet, op imap.FlagsOp, flags []string) error

UpdateMessagesFlags will update flags

type Message

type Message struct {
	UID     uint32
	ID      string
	Date    time.Time
	Size    uint32
	Flags   []string
	DMsg    *bmmessage.DecryptedMessage
	User    *User
	FullMsg []byte
}

Message holds all the information needed to retrieve a full message

func (*Message) Build

func (m *Message) Build() error

Build will create the message to be read

func (*Message) Decrypt

func (m *Message) Decrypt() error

Decrypt a message and store it decrypted

func (*Message) Fetch

func (m *Message) Fetch(seqNum uint32, items []imap.FetchItem, user *User) (*imap.Message, error)

Fetch will retrieve a message

func (*Message) Match

func (m *Message) Match(seqNum uint32, c *imap.SearchCriteria) (bool, error)

Match checks if the message is the same

type User

type User struct {
	Account string
	Vault   *vault.Vault
	Info    *vault.AccountInfo
	Client  *api.API
}

User holds the user info

func (*User) CreateMailbox

func (u *User) CreateMailbox(name string) error

CreateMailbox is not implemented yet

func (*User) DeleteMailbox

func (u *User) DeleteMailbox(name string) error

DeleteMailbox is not implemented yet

func (*User) GetMailbox

func (u *User) GetMailbox(name string) (backend.Mailbox, error)

GetMailbox from server

func (*User) ListMailboxes

func (u *User) ListMailboxes(subscribed bool) (mailboxes []backend.Mailbox, err error)

ListMailboxes for the user

func (*User) Logout

func (u *User) Logout() error

Logout from server

func (*User) RenameMailbox

func (u *User) RenameMailbox(existingName, newName string) error

RenameMailbox is not implemented yet

func (*User) Username

func (u *User) Username() string

Username from account

Jump to

Keyboard shortcuts

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