diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-11 15:24:39 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-12-11 15:24:39 +0100 |
commit | f07ab5263246d940fbc1d646bcdb5663398378d0 (patch) | |
tree | 3610a240635cbbac0932c359defd2962c05c3d75 /server.go | |
parent | 1b5bc568fb638314b62ea3d6635de56109680da9 (diff) | |
download | alps-f07ab5263246d940fbc1d646bcdb5663398378d0.tar.gz alps-f07ab5263246d940fbc1d646bcdb5663398378d0.zip |
Add docs
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -14,9 +14,10 @@ const cookieName = "koushin_session" const messagesPerPage = 50 +// Server holds all the koushin server state. type Server struct { Sessions *SessionManager - Plugins []Plugin + Plugins []Plugin imap struct { host string @@ -98,11 +99,13 @@ func newServer(imapURL, smtpURL string) (*Server, error) { type Context struct { echo.Context Server *Server - Session *Session + Session *Session // nil if user isn't logged in } var aLongTimeAgo = time.Unix(233431200, 0) +// SetSession sets a cookie for the provided session. Passing a nil session +// unsets the cookie. func (ctx *Context) SetSession(s *Session) { cookie := http.Cookie{ Name: cookieName, @@ -127,6 +130,7 @@ type Options struct { Theme string } +// New creates a new server. func New(e *echo.Echo, options *Options) error { s, err := newServer(options.IMAPURL, options.SMTPURL) if err != nil { |