web

package
v0.0.0-...-dcb6a6f Latest Latest
Warning

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

Go to latest
Published: May 6, 2014 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

The web package contains all the code to provide Inbucket's web GUI

Index

Constants

This section is empty.

Variables

View Source
var DataStore smtpd.DataStore
View Source
var Router *mux.Router
View Source
var TemplateFuncs = template.FuncMap{
	"friendlyTime": friendlyTime,
	"reverse":      reverse,
	"textToHtml":   textToHtml,
}

Functions

func Initialize

func Initialize(cfg config.WebConfig, ds smtpd.DataStore)

Initialize sets up things for unit tests or the Start() method

func MailboxDelete

func MailboxDelete(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)

func MailboxDownloadAttach

func MailboxDownloadAttach(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)

func MailboxHtml

func MailboxHtml(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)

func MailboxIndex

func MailboxIndex(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)
func MailboxLink(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)

func MailboxList

func MailboxList(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)

func MailboxPurge

func MailboxPurge(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)

func MailboxShow

func MailboxShow(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)

func MailboxSource

func MailboxSource(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)

func MailboxViewAttach

func MailboxViewAttach(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)

func ParseTemplate

func ParseTemplate(name string, partial bool) (*template.Template, error)

ParseTemplate loads the requested template along with _base.html, caching the result (if configured to do so)

func RenderJson

func RenderJson(w http.ResponseWriter, data interface{}) error

func RenderPartial

func RenderPartial(name string, w http.ResponseWriter, data interface{}) error

RenderPartial fetches the named template and renders it to the provided ResponseWriter.

func RenderTemplate

func RenderTemplate(name string, w http.ResponseWriter, data interface{}) error

RenderTemplate fetches the named template and renders it to the provided ResponseWriter.

func RootIndex

func RootIndex(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)

func RootStatus

func RootStatus(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)

func Start

func Start()

Start() the web server

func Stop

func Stop()

Types

type Context

type Context struct {
	Vars      map[string]string
	Session   *sessions.Session
	DataStore smtpd.DataStore
	IsJson    bool
}

func NewContext

func NewContext(req *http.Request) (*Context, error)

func (*Context) Close

func (c *Context) Close()

type JsonMessage

type JsonMessage struct {
	Mailbox, Id, From, Subject string
	Date                       time.Time
	Size                       int64
	Body                       *JsonMessageBody
	Header                     mail.Header
}

type JsonMessageBody

type JsonMessageBody struct {
	Text, Html string
}

type JsonMessageHeader

type JsonMessageHeader struct {
	Mailbox, Id, From, Subject string
	Date                       time.Time
	Size                       int64
}

Jump to

Keyboard shortcuts

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