mailbox

package
v0.0.0-...-b47b16d Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2015 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(cfg *m2a.Config, router *mux.Router)

func FoldersHandler

func FoldersHandler(resp http.ResponseWriter, req *http.Request)

Handle /mailbox/<email>/folders

func GetImapClient

func GetImapClient(resp http.ResponseWriter, req *http.Request) *imap.Client

== Check credentials of account via db, and connect with IMAP (shorter timeout)

func GetLastUIDs

func GetLastUIDs(alluids []uint32) *imap.SeqSet

func GetUIDs

func GetUIDs(mbox string, client *imap.Client) ([]uint32, error)

func MessageHandler

func MessageHandler(resp http.ResponseWriter, req *http.Request)

func SendErrorPayload

func SendErrorPayload(err string, resp http.ResponseWriter)

func SetAjaxHeaders

func SetAjaxHeaders(w http.ResponseWriter)

Content-Type to json, and allow origin

func SummaryHandler

func SummaryHandler(resp http.ResponseWriter, req *http.Request)

Types

type ErrorPayload

type ErrorPayload struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

===============================================

type Folder

type Folder struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

func GetFolders

func GetFolders(client *imap.Client) ([]*Folder, error)

= Return list of IMAP folders

type FoldersPayload

type FoldersPayload struct {
	Success bool      `json:"success"`
	Folders []*Folder `json:"folders"`
	Error   string    `json:"error"`
}
type Header struct {
	Uid uint32 `json:"uid"`

	FromName  string `json:"from_name"`
	FromEmail string `json:"from_email"`
	Subject   string `json:"subject"`

	Date string `json:"date"`

	Seen     bool `json:"seen"`
	Flagged  bool `json:"flagged"`
	Answered bool `json:"answered"`
}

===================================================================

type MbLogin

type MbLogin struct {
	Email    string
	Password string
	Active   uint
}

===============================================

type Message

type Message struct {
	Uid    uint32 `json:"uid"`
	Folder string `json:"folder"`

	FromName  string `json:"from_name"`
	FromEmail string `json:"from_email"`

	Date string `json:"date"`

	Seen     bool `json:"seen"`
	Flagged  bool `json:"flagged"`
	Answered bool `json:"answered"`

	Subject  string `json:"subject"`
	BodyHtml string `json:"body_html"`
	BodyText string `json:"body_text"`

	ContentType string `json:"content_type"`
}

===================================================================

func GetMessage

func GetMessage(folder, uid string, client *imap.Client) (messag *Message, e error)

type MessagePayload

type MessagePayload struct {
	Success bool     `json:"success"`
	Message *Message `json:"message"`

	Error string `json:"error"`
}

type SummaryPayload

type SummaryPayload struct {
	Headers []*Header `json:"headers"`
	Success bool      `json:"success"`
	Folders []*Folder `json:"folders"`
	Uids    []uint32  `json:"uids"`

	Error string `json:"error"`
}

Jump to

Keyboard shortcuts

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