Commit graph

26 commits

Author SHA1 Message Date
Simon Ser
556ce5b2c8 go fmt 2021-07-05 11:19:07 +02:00
Drew DeVault
cb37df882e Add notices on action completion 2020-11-19 11:17:40 -05:00
Drew DeVault
297afc5ce6 Limit total size of unsent attachments 2020-11-19 09:28:10 -05:00
Drew DeVault
86579bb478 Remove async SMTP queue 2020-11-13 10:33:19 -05:00
Drew DeVault
a393429f01 Implement JavaScript UI for attachments
This one is a bit of a doozy. A summary of the changes:

- Session has grown storage for attachments which have been uploaded but
  not yet sent.
- The list of attachments on a message is refcounted so that we can
  clean up the temporary files only after it's done with - i.e. after
  copying to Sent and after all of the SMTP attempts are done.
- Abandoned attachments are cleared out on process shutdown.

Future work:
- Add a limit to the maximum number of pending attachments the user can
  have in the session.
- Periodically clean out abandoned attachments?
2020-10-29 15:18:36 -04:00
Simon Ser
b891a95fcf
Rename project to alps 2020-05-13 14:07:44 +02:00
Simon Ser
13f5414691
cmd/koushin: add -debug flag 2020-02-11 18:39:52 +01:00
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
Renamed from conn_pool.go (Browse further)