diff --git a/plugins/base/public/message.html b/plugins/base/public/message.html index 56e6e6f..b41ae39 100644 --- a/plugins/base/public/message.html +++ b/plugins/base/public/message.html @@ -49,24 +49,32 @@ {{end}} +{{define "addr-list"}} + {{range $i := .}} + {{if $i}},{{end}} + {{.PersonalName}} + <{{.Address}}> + {{end}} +{{end}} + diff --git a/plugins/base/routes.go b/plugins/base/routes.go index 84126d3..d73dfea 100644 --- a/plugins/base/routes.go +++ b/plugins/base/routes.go @@ -263,6 +263,11 @@ func handleCompose(ectx echo.Context) error { msg.From = ctx.Session.Username() } + msg.To = strings.Split(ctx.QueryParam("to"), ",") + msg.Subject = ctx.QueryParam("subject") + msg.Text = ctx.QueryParam("body") + msg.InReplyTo = ctx.QueryParam("in-reply-to") + if ctx.Request().Method == http.MethodGet && ctx.Param("uid") != "" { // This is a reply mboxName, uid, err := parseMboxAndUid(ctx.Param("mbox"), ctx.Param("uid")) diff --git a/plugins/base/template.go b/plugins/base/template.go index 714ca3c..d867ff3 100644 --- a/plugins/base/template.go +++ b/plugins/base/template.go @@ -3,7 +3,6 @@ package koushinbase import ( "html/template" "net/url" - "strings" "time" "github.com/emersion/go-imap" @@ -16,13 +15,6 @@ var templateFuncs = template.FuncMap{ "pathescape": func(s string) string { return url.PathEscape(s) }, - "formataddrlist": func(addrs []*imap.Address) string { - l := make([]string, len(addrs)) - for i, addr := range addrs { - l[i] = addr.PersonalName + " <" + addr.Address() + ">" - } - return strings.Join(l, ", ") - }, "formatdate": func(t time.Time) string { return t.Format("Mon Jan 02 15:04") },