diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-16 15:40:30 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-12-16 15:40:30 +0100 |
commit | 08b259bd50155c53259ae60042c8626a3615a993 (patch) | |
tree | b250326fc63d9230cb151a636f5e00a0a86d4ca5 /plugins/base/handlers.go | |
parent | 7f48702b83a62cccae67562ca2d07fafb274a3ef (diff) | |
download | alps-08b259bd50155c53259ae60042c8626a3615a993.tar.gz alps-08b259bd50155c53259ae60042c8626a3615a993.zip |
Add attachments support to composer
Closes: https://todo.sr.ht/~sircmpwn/koushin/13
Diffstat (limited to 'plugins/base/handlers.go')
-rw-r--r-- | plugins/base/handlers.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/base/handlers.go b/plugins/base/handlers.go index 133052c..e939cc5 100644 --- a/plugins/base/handlers.go +++ b/plugins/base/handlers.go @@ -270,7 +270,13 @@ func handleCompose(ectx echo.Context) error { msg.Text = ctx.FormValue("text") msg.InReplyTo = ctx.FormValue("in_reply_to") - err := ctx.Session.DoSMTP(func(c *smtp.Client) error { + form, err := ctx.MultipartForm() + if err != nil { + return fmt.Errorf("failed to get multipart form: %v", err) + } + msg.Attachments = form.File["attachments"] + + err = ctx.Session.DoSMTP(func(c *smtp.Client) error { return sendMessage(c, &msg) }) if err != nil { |