go fmt
This commit is contained in:
parent
7adc90e229
commit
556ce5b2c8
5 changed files with 27 additions and 27 deletions
|
@ -12,10 +12,10 @@ import (
|
|||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/emersion/go-imap"
|
||||
imapspecialuse "github.com/emersion/go-imap-specialuse"
|
||||
imapclient "github.com/emersion/go-imap/client"
|
||||
"github.com/emersion/go-message"
|
||||
"github.com/emersion/go-message/textproto"
|
||||
imapclient "github.com/emersion/go-imap/client"
|
||||
imapspecialuse "github.com/emersion/go-imap-specialuse"
|
||||
)
|
||||
|
||||
type MailboxInfo struct {
|
||||
|
|
|
@ -14,13 +14,13 @@ import (
|
|||
|
||||
"git.sr.ht/~migadu/alps"
|
||||
"github.com/emersion/go-imap"
|
||||
imapmove "github.com/emersion/go-imap-move"
|
||||
imapclient "github.com/emersion/go-imap/client"
|
||||
"github.com/emersion/go-message"
|
||||
"github.com/emersion/go-message/mail"
|
||||
"github.com/emersion/go-smtp"
|
||||
"github.com/labstack/echo/v4"
|
||||
"jaytaylor.com/html2text"
|
||||
imapclient "github.com/emersion/go-imap/client"
|
||||
imapmove "github.com/emersion/go-imap-move"
|
||||
)
|
||||
|
||||
func registerRoutes(p *alps.GoPlugin) {
|
||||
|
@ -85,9 +85,9 @@ type IMAPBaseRenderData struct {
|
|||
|
||||
type MailboxRenderData struct {
|
||||
IMAPBaseRenderData
|
||||
Messages []IMAPMessage
|
||||
PrevPage, NextPage int
|
||||
Query string
|
||||
Messages []IMAPMessage
|
||||
PrevPage, NextPage int
|
||||
Query string
|
||||
}
|
||||
|
||||
type MailboxDetails struct {
|
||||
|
@ -111,7 +111,7 @@ type CategorizedMailboxes struct {
|
|||
func (cc *CategorizedMailboxes) Append(mi MailboxInfo, status *MailboxStatus) {
|
||||
name := mi.Name
|
||||
details := &MailboxDetails{
|
||||
Info: &mi,
|
||||
Info: &mi,
|
||||
Status: status,
|
||||
}
|
||||
if name == "INBOX" {
|
||||
|
@ -245,7 +245,7 @@ func handleGetMailbox(ctx *alps.Context) error {
|
|||
total int
|
||||
)
|
||||
err = ctx.Session.DoIMAP(func(c *imapclient.Client) error {
|
||||
var err error
|
||||
var err error
|
||||
if query != "" {
|
||||
msgs, total, err = searchMessages(c, mbox.Name, query, page, messagesPerPage)
|
||||
} else {
|
||||
|
@ -278,11 +278,11 @@ func handleGetMailbox(ctx *alps.Context) error {
|
|||
}
|
||||
|
||||
return ctx.Render(http.StatusOK, "mailbox.html", &MailboxRenderData{
|
||||
IMAPBaseRenderData: *ibase,
|
||||
Messages: msgs,
|
||||
PrevPage: prevPage,
|
||||
NextPage: nextPage,
|
||||
Query: query,
|
||||
IMAPBaseRenderData: *ibase,
|
||||
Messages: msgs,
|
||||
PrevPage: prevPage,
|
||||
NextPage: nextPage,
|
||||
Query: query,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ func handleNewMailbox(ctx *alps.Context) error {
|
|||
if name == "" {
|
||||
return ctx.Render(http.StatusOK, "new-mailbox.html", &NewMailboxRenderData{
|
||||
IMAPBaseRenderData: *ibase,
|
||||
Error: "Name is required",
|
||||
Error: "Name is required",
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,7 @@ func handleNewMailbox(ctx *alps.Context) error {
|
|||
if err != nil {
|
||||
return ctx.Render(http.StatusOK, "new-mailbox.html", &NewMailboxRenderData{
|
||||
IMAPBaseRenderData: *ibase,
|
||||
Error: err.Error(),
|
||||
Error: err.Error(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ func handleNewMailbox(ctx *alps.Context) error {
|
|||
|
||||
return ctx.Render(http.StatusOK, "new-mailbox.html", &NewMailboxRenderData{
|
||||
IMAPBaseRenderData: *ibase,
|
||||
Error: "",
|
||||
Error: "",
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -520,7 +520,7 @@ type composeOptions struct {
|
|||
// Send message, append it to the Sent mailbox, mark the original message as
|
||||
// answered
|
||||
func submitCompose(ctx *alps.Context, msg *OutgoingMessage, options *composeOptions) error {
|
||||
err := ctx.Session.DoSMTP(func (c *smtp.Client) error {
|
||||
err := ctx.Session.DoSMTP(func(c *smtp.Client) error {
|
||||
return sendMessage(c, msg)
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -571,7 +571,7 @@ func handleCompose(ctx *alps.Context, msg *OutgoingMessage, options *composeOpti
|
|||
}
|
||||
if settings.From != "" {
|
||||
addr := mail.Address{
|
||||
Name: settings.From,
|
||||
Name: settings.From,
|
||||
Address: ctx.Session.Username(),
|
||||
}
|
||||
msg.From = addr.String()
|
||||
|
|
|
@ -87,7 +87,7 @@ func splitSearchTokens(buf []byte, eof bool) (int, []byte, error) {
|
|||
terminator int
|
||||
quoted bool
|
||||
)
|
||||
if colon + 1 < len(buf) && buf[colon+1] == byte('"') {
|
||||
if colon+1 < len(buf) && buf[colon+1] == byte('"') {
|
||||
terminator = bytes.IndexByte(buf[colon+2:], byte('"'))
|
||||
terminator += colon + 3
|
||||
quoted = true
|
||||
|
|
|
@ -396,9 +396,9 @@ func New(e *echo.Echo, options *Options) (*Server, error) {
|
|||
}
|
||||
rdata := ErrorRenderData{
|
||||
BaseRenderData: *NewBaseRenderData(ctx),
|
||||
Err: err,
|
||||
Code: code,
|
||||
Status: http.StatusText(code),
|
||||
Err: err,
|
||||
Code: code,
|
||||
Status: http.StatusText(code),
|
||||
}
|
||||
|
||||
if err := ctx.Render(code, "error.html", &rdata); err != nil {
|
||||
|
|
|
@ -32,7 +32,7 @@ func generateToken() (string, error) {
|
|||
}
|
||||
|
||||
var (
|
||||
ErrSessionExpired = errors.New("session expired")
|
||||
ErrSessionExpired = errors.New("session expired")
|
||||
ErrAttachmentCacheSize = errors.New("Attachments on session exceed maximum file size")
|
||||
)
|
||||
|
||||
|
@ -157,13 +157,13 @@ func (s *Session) PutAttachment(in *multipart.FileHeader,
|
|||
for _, a := range s.attachments {
|
||||
size += a.File.Size
|
||||
}
|
||||
if size + in.Size > maxAttachmentSize {
|
||||
if size+in.Size > maxAttachmentSize {
|
||||
return "", ErrAttachmentCacheSize
|
||||
}
|
||||
|
||||
s.attachments[id.String()] = &Attachment{
|
||||
File: in,
|
||||
Form: form,
|
||||
File: in,
|
||||
Form: form,
|
||||
}
|
||||
s.attachmentsLocker.Unlock()
|
||||
return id.String(), nil
|
||||
|
|
Loading…
Add table
Reference in a new issue