Commit graph

12 commits

Author SHA1 Message Date
Simon Ser
7f48702b83
go fmt 2019-12-16 14:53:56 +01:00
Simon Ser
622f00fe06
Replace Session.ConnectSMTP with Session.DoSMTP
This gives more flexibility in Session for optimizations, e.g. keep the
SMTP connection around for some time if possible.
2019-12-16 13:07:35 +01:00
Simon Ser
d01c85616a
Rename Session.Do to Session.DoIMAP 2019-12-16 13:01:33 +01:00
Simon Ser
d897eeee5c
Introduce base plugin
This plugin offers base IMAP/SMTP functionality.

References: https://todo.sr.ht/~sircmpwn/koushin/39
2019-12-16 12:52:44 +01:00
Simon Ser
b24cc85fb1
Fix undefined ErrSessionExpired
Fixes: f07ab52632 ("Add docs")
2019-12-12 16:40:52 +01:00
Simon Ser
f07ab52632
Add docs 2019-12-11 15:24:39 +01:00
Simon Ser
e54a359acb
Export Server.{Sessions,Plugins}
And unexport a few internal functions.
2019-12-11 13:03:31 +01:00
Simon Ser
28a8f3f6ac
Unexport NewSessionManager
This isn't intended to be used by plugins.
2019-12-11 12:56:59 +01:00
Simon Ser
86359156ee
Export Context.SetSession, unexport Session.Token
I'm uneasy exposing the token to plugins, I prefer to hide it if
possible to prevent mis-use.

This change allows plugins to logout users.
2019-12-11 12:54:03 +01:00
Simon Ser
c5afd1a61b
Reconnect to IMAP server when logged out
The session manager has been upgraded to deal with reconnections.

Each session has its own expiration timer. Each time a request is
received, the expiration timer is reset.

A session can be closed (this is used when the user wants to logout).

When the IMAP connection is closed by the server, it's set to nil in the
session. The next time an IMAP command needs to be issued, the
connection is re-established.

Closes: https://todo.sr.ht/~sircmpwn/koushin/30
2019-12-09 19:35:15 +01:00
Simon Ser
7702925497
Make SessionManager create the IMAP client
This will allow SessionManager to re-connect when the IMAP server logs
the user out.
2019-12-09 18:35:51 +01:00
Simon Ser
efd401bfbf
Rename ConnPool to SessionManager 2019-12-09 18:16:31 +01:00
Renamed from conn_pool.go (Browse further)