Simon Ser
97eef13db4
Rename Session.connect to Session.connectIMAP
2020-02-10 17:21:34 +01:00
Simon Ser
bdf1a8b02b
koushin: add Store interface
...
References: https://todo.sr.ht/~sircmpwn/koushin/5
2020-01-28 20:04:18 +01:00
Simon Ser
c0b4998b38
koushin: rename Session.locker to imapLocker
2020-01-28 15:41:18 +01:00
Simon Ser
e6e457e4a7
Fix dangling goroutine on session expiration
...
The timer channel may already have been drained by `case <-timer.C`. In
this case, we need not to drain it again or we'll block forever.
To fix this, stop draining the timer channel. Since we're not going to
use the timer again anyway, it should be fine.
2020-01-20 15:25:46 +01:00
Simon Ser
8b10324ab6
go fmt
2020-01-20 13:22:18 +01:00
Simon Ser
425445f443
Add Session.SetHTTPBasicAuth
...
This is not 100% idiot-proof, but still makes it mroe difficult for
plugins to steal credentials.
2020-01-10 19:37:24 +01:00
Simon Ser
6bccdd62ce
Document that plugins don't have access to passwords
2019-12-17 15:55:52 +01:00
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