go vet: composite literal uses unkeyed fields

This commit fixes all occurrences of the abovementioned lint-error in
the codebase.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Moritz Poldrack 2022-03-18 09:53:02 +01:00 committed by Robin Jarry
parent 62a5ebb1e1
commit e30bd324a3
15 changed files with 102 additions and 102 deletions

View File

@ -136,18 +136,18 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
}) })
basics := ui.NewGrid().Rows([]ui.GridSpec{ basics := ui.NewGrid().Rows([]ui.GridSpec{
{ui.SIZE_EXACT, ui.Const(8)}, // Introduction {Strategy: ui.SIZE_EXACT, Size: ui.Const(8)}, // Introduction
{ui.SIZE_EXACT, ui.Const(1)}, // Account name (label) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Account name (label)
{ui.SIZE_EXACT, ui.Const(1)}, // (input) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input)
{ui.SIZE_EXACT, ui.Const(1)}, // Padding {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding
{ui.SIZE_EXACT, ui.Const(1)}, // Full name (label) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Full name (label)
{ui.SIZE_EXACT, ui.Const(1)}, // (input) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input)
{ui.SIZE_EXACT, ui.Const(1)}, // Padding {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding
{ui.SIZE_EXACT, ui.Const(1)}, // Email address (label) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Email address (label)
{ui.SIZE_EXACT, ui.Const(1)}, // (input) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input)
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}).Columns([]ui.GridSpec{ }).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
basics.AddChild( basics.AddChild(
ui.NewText("\nWelcome to aerc! Let's configure your account.\n\n"+ ui.NewText("\nWelcome to aerc! Let's configure your account.\n\n"+
@ -212,23 +212,23 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
}) })
incoming := ui.NewGrid().Rows([]ui.GridSpec{ incoming := ui.NewGrid().Rows([]ui.GridSpec{
{ui.SIZE_EXACT, ui.Const(3)}, // Introduction {Strategy: ui.SIZE_EXACT, Size: ui.Const(3)}, // Introduction
{ui.SIZE_EXACT, ui.Const(1)}, // Username (label) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Username (label)
{ui.SIZE_EXACT, ui.Const(1)}, // (input) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input)
{ui.SIZE_EXACT, ui.Const(1)}, // Padding {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding
{ui.SIZE_EXACT, ui.Const(1)}, // Password (label) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Password (label)
{ui.SIZE_EXACT, ui.Const(1)}, // (input) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input)
{ui.SIZE_EXACT, ui.Const(1)}, // Padding {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding
{ui.SIZE_EXACT, ui.Const(1)}, // Server (label) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Server (label)
{ui.SIZE_EXACT, ui.Const(1)}, // (input) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input)
{ui.SIZE_EXACT, ui.Const(1)}, // Padding {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding
{ui.SIZE_EXACT, ui.Const(1)}, // Connection mode (label) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Connection mode (label)
{ui.SIZE_EXACT, ui.Const(2)}, // (input) {Strategy: ui.SIZE_EXACT, Size: ui.Const(2)}, // (input)
{ui.SIZE_EXACT, ui.Const(1)}, // Padding {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding
{ui.SIZE_EXACT, ui.Const(1)}, // Connection string {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Connection string
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}).Columns([]ui.GridSpec{ }).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
incoming.AddChild(ui.NewText("\nConfigure incoming mail (IMAP)", incoming.AddChild(ui.NewText("\nConfigure incoming mail (IMAP)",
conf.Ui.GetStyle(config.STYLE_DEFAULT))) conf.Ui.GetStyle(config.STYLE_DEFAULT)))
@ -291,26 +291,26 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
}) })
outgoing := ui.NewGrid().Rows([]ui.GridSpec{ outgoing := ui.NewGrid().Rows([]ui.GridSpec{
{ui.SIZE_EXACT, ui.Const(3)}, // Introduction {Strategy: ui.SIZE_EXACT, Size: ui.Const(3)}, // Introduction
{ui.SIZE_EXACT, ui.Const(1)}, // Username (label) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Username (label)
{ui.SIZE_EXACT, ui.Const(1)}, // (input) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input)
{ui.SIZE_EXACT, ui.Const(1)}, // Padding {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding
{ui.SIZE_EXACT, ui.Const(1)}, // Password (label) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Password (label)
{ui.SIZE_EXACT, ui.Const(1)}, // (input) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input)
{ui.SIZE_EXACT, ui.Const(1)}, // Padding {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding
{ui.SIZE_EXACT, ui.Const(1)}, // Server (label) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Server (label)
{ui.SIZE_EXACT, ui.Const(1)}, // (input) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input)
{ui.SIZE_EXACT, ui.Const(1)}, // Padding {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding
{ui.SIZE_EXACT, ui.Const(1)}, // Connection mode (label) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Connection mode (label)
{ui.SIZE_EXACT, ui.Const(2)}, // (input) {Strategy: ui.SIZE_EXACT, Size: ui.Const(2)}, // (input)
{ui.SIZE_EXACT, ui.Const(1)}, // Padding {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding
{ui.SIZE_EXACT, ui.Const(1)}, // Connection string {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Connection string
{ui.SIZE_EXACT, ui.Const(1)}, // Padding {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding
{ui.SIZE_EXACT, ui.Const(1)}, // Copy to sent (label) {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Copy to sent (label)
{ui.SIZE_EXACT, ui.Const(2)}, // (input) {Strategy: ui.SIZE_EXACT, Size: ui.Const(2)}, // (input)
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}).Columns([]ui.GridSpec{ }).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
outgoing.AddChild(ui.NewText("\nConfigure outgoing mail (SMTP)", outgoing.AddChild(ui.NewText("\nConfigure outgoing mail (SMTP)",
conf.Ui.GetStyle(config.STYLE_DEFAULT))) conf.Ui.GetStyle(config.STYLE_DEFAULT)))
@ -387,10 +387,10 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard {
}) })
complete := ui.NewGrid().Rows([]ui.GridSpec{ complete := ui.NewGrid().Rows([]ui.GridSpec{
{ui.SIZE_EXACT, ui.Const(7)}, // Introduction {Strategy: ui.SIZE_EXACT, Size: ui.Const(7)}, // Introduction
{ui.SIZE_WEIGHT, ui.Const(1)}, // Previous / Finish / Finish & open tutorial {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, // Previous / Finish / Finish & open tutorial
}).Columns([]ui.GridSpec{ }).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
complete.AddChild(ui.NewText( complete.AddChild(ui.NewText(
"\nConfiguration complete!\n\n"+ "\nConfiguration complete!\n\n"+

View File

@ -58,12 +58,12 @@ func NewAccountView(aerc *Aerc, conf *config.AercConfig, acct *config.AccountCon
} }
view.grid = ui.NewGrid().Rows([]ui.GridSpec{ view.grid = ui.NewGrid().Rows([]ui.GridSpec{
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}).Columns([]ui.GridSpec{ }).Columns([]ui.GridSpec{
{ui.SIZE_EXACT, func() int { {Strategy: ui.SIZE_EXACT, Size: func() int {
return view.UiConfig().SidebarWidth return view.UiConfig().SidebarWidth
}}, }},
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
worker, err := worker.NewWorker(acct.Source, logger) worker, err := worker.NewWorker(acct.Source, logger)

View File

@ -57,11 +57,11 @@ func NewAerc(conf *config.AercConfig, logger *log.Logger,
statusbar.Push(statusline) statusbar.Push(statusline)
grid := ui.NewGrid().Rows([]ui.GridSpec{ grid := ui.NewGrid().Rows([]ui.GridSpec{
{ui.SIZE_EXACT, ui.Const(1)}, {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)},
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
{ui.SIZE_EXACT, ui.Const(1)}, {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)},
}).Columns([]ui.GridSpec{ }).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
grid.AddChild(tabs.TabStrip) grid.AddChild(tabs.TabStrip)
grid.AddChild(tabs.TabContent).At(1, 0) grid.AddChild(tabs.TabContent).At(1, 0)
@ -667,11 +667,11 @@ func errorScreen(s string, conf config.UIConfig) ui.Drawable {
errstyle := conf.GetStyle(config.STYLE_ERROR) errstyle := conf.GetStyle(config.STYLE_ERROR)
text := ui.NewText(s, errstyle).Strategy(ui.TEXT_CENTER) text := ui.NewText(s, errstyle).Strategy(ui.TEXT_CENTER)
grid := ui.NewGrid().Rows([]ui.GridSpec{ grid := ui.NewGrid().Rows([]ui.GridSpec{
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
{ui.SIZE_EXACT, ui.Const(1)}, {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)},
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}).Columns([]ui.GridSpec{ }).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
grid.AddChild(ui.NewFill(' ', tcell.StyleDefault)).At(0, 0) grid.AddChild(ui.NewFill(' ', tcell.StyleDefault)).At(0, 0)
grid.AddChild(text).At(1, 0) grid.AddChild(text).At(1, 0)

View File

@ -783,14 +783,14 @@ func (c *Composer) updateGrid() {
if c.grid == nil { if c.grid == nil {
c.grid = ui.NewGrid().Columns([]ui.GridSpec{ c.grid = ui.NewGrid().Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
} }
c.grid.Rows([]ui.GridSpec{ c.grid.Rows([]ui.GridSpec{
{ui.SIZE_EXACT, ui.Const(height)}, {Strategy: ui.SIZE_EXACT, Size: ui.Const(height)},
{ui.SIZE_EXACT, ui.Const(1)}, {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)},
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
if c.heditors != nil { if c.heditors != nil {
@ -979,21 +979,21 @@ func newReviewMessage(composer *Composer, err error) *reviewMessage {
} }
spec := []ui.GridSpec{ spec := []ui.GridSpec{
{ui.SIZE_EXACT, ui.Const(1)}, {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)},
} }
for i := 0; i < len(actions)-1; i++ { for i := 0; i < len(actions)-1; i++ {
spec = append(spec, ui.GridSpec{ui.SIZE_EXACT, ui.Const(1)}) spec = append(spec, ui.GridSpec{Strategy: ui.SIZE_EXACT, Size: ui.Const(1)})
} }
spec = append(spec, ui.GridSpec{ui.SIZE_EXACT, ui.Const(2)}) spec = append(spec, ui.GridSpec{Strategy: ui.SIZE_EXACT, Size: ui.Const(2)})
spec = append(spec, ui.GridSpec{ui.SIZE_EXACT, ui.Const(1)}) spec = append(spec, ui.GridSpec{Strategy: ui.SIZE_EXACT, Size: ui.Const(1)})
for i := 0; i < len(composer.attachments)-1; i++ { for i := 0; i < len(composer.attachments)-1; i++ {
spec = append(spec, ui.GridSpec{ui.SIZE_EXACT, ui.Const(1)}) spec = append(spec, ui.GridSpec{Strategy: ui.SIZE_EXACT, Size: ui.Const(1)})
} }
// make the last element fill remaining space // make the last element fill remaining space
spec = append(spec, ui.GridSpec{ui.SIZE_WEIGHT, ui.Const(1)}) spec = append(spec, ui.GridSpec{Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)})
grid := ui.NewGrid().Rows(spec).Columns([]ui.GridSpec{ grid := ui.NewGrid().Rows(spec).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
uiConfig := composer.config.Ui uiConfig := composer.config.Ui

View File

@ -71,7 +71,7 @@ func NewMessageViewer(acct *AccountView,
) )
rows := []ui.GridSpec{ rows := []ui.GridSpec{
{ui.SIZE_EXACT, ui.Const(headerHeight)}, {Strategy: ui.SIZE_EXACT, Size: ui.Const(headerHeight)},
} }
if msg.PGPDetails() != nil { if msg.PGPDetails() != nil {
@ -79,16 +79,16 @@ func NewMessageViewer(acct *AccountView,
if msg.PGPDetails().IsSigned && msg.PGPDetails().IsEncrypted { if msg.PGPDetails().IsSigned && msg.PGPDetails().IsEncrypted {
height = 2 height = 2
} }
rows = append(rows, ui.GridSpec{ui.SIZE_EXACT, ui.Const(height)}) rows = append(rows, ui.GridSpec{Strategy: ui.SIZE_EXACT, Size: ui.Const(height)})
} }
rows = append(rows, []ui.GridSpec{ rows = append(rows, []ui.GridSpec{
{ui.SIZE_EXACT, ui.Const(1)}, {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)},
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}...) }...)
grid := ui.NewGrid().Rows(rows).Columns([]ui.GridSpec{ grid := ui.NewGrid().Rows(rows).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
switcher := &PartSwitcher{} switcher := &PartSwitcher{}
@ -539,11 +539,11 @@ func NewPartViewer(acct *AccountView, conf *config.AercConfig,
} }
grid := ui.NewGrid().Rows([]ui.GridSpec{ grid := ui.NewGrid().Rows([]ui.GridSpec{
{ui.SIZE_EXACT, ui.Const(3)}, // Message {Strategy: ui.SIZE_EXACT, Size: ui.Const(3)}, // Message
{ui.SIZE_EXACT, ui.Const(1)}, // Selector {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Selector
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}).Columns([]ui.GridSpec{ }).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, ui.Const(1)}, {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)},
}) })
selector := NewSelector([]string{"Save message", "Pipe to command"}, selector := NewSelector([]string{"Save message", "Pipe to command"},

View File

@ -14,6 +14,6 @@ func (imapw *IMAPWorker) handleCreateDirectory(msg *types.CreateDirectory) {
Error: err, Error: err,
}, nil) }, nil)
} else { } else {
imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
} }
} }

View File

@ -46,7 +46,7 @@ func (imapw *IMAPWorker) handleFetchMessageHeaders(
}, nil) }, nil)
return nil return nil
} }
header := &mail.Header{message.Header{textprotoHeader}} header := &mail.Header{Header: message.Header{Header: textprotoHeader}}
imapw.worker.PostMessage(&types.MessageInfo{ imapw.worker.PostMessage(&types.MessageInfo{
Message: types.RespondTo(msg), Message: types.RespondTo(msg),
Info: &models.MessageInfo{ Info: &models.MessageInfo{
@ -100,7 +100,7 @@ func (imapw *IMAPWorker) handleFetchMessageBodyPart(
return fmt.Errorf("failed to read part header: %v", err) return fmt.Errorf("failed to read part header: %v", err)
} }
part, err := message.New(message.Header{h}, part, err := message.New(message.Header{Header: h},
_msg.GetBody(&partBodySection)) _msg.GetBody(&partBodySection))
if err != nil { if err != nil {
return fmt.Errorf("failed to create message reader: %v", err) return fmt.Errorf("failed to create message reader: %v", err)
@ -202,5 +202,5 @@ func (imapw *IMAPWorker) handleFetchMessages(
return return
} }
imapw.worker.PostMessage( imapw.worker.PostMessage(
&types.Done{types.RespondTo(msg)}, nil) &types.Done{Message: types.RespondTo(msg)}, nil)
} }

View File

@ -40,7 +40,7 @@ func (imapw *IMAPWorker) handleDeleteMessages(msg *types.DeleteMessages) {
Message: types.RespondTo(msg), Message: types.RespondTo(msg),
Uids: deleted, Uids: deleted,
}, nil) }, nil)
imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
} }
} }
@ -71,7 +71,7 @@ func (imapw *IMAPWorker) handleAnsweredMessages(msg *types.AnsweredMessages) {
imapw.worker.Logger.Printf("could not fetch headers: %s", err) imapw.worker.Logger.Printf("could not fetch headers: %s", err)
emitErr(err) emitErr(err)
case *types.Done: case *types.Done:
imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
} }
}) })
} }
@ -102,7 +102,7 @@ func (imapw *IMAPWorker) handleFlagMessages(msg *types.FlagMessages) {
imapw.worker.Logger.Printf("could not fetch headers: %s", err) imapw.worker.Logger.Printf("could not fetch headers: %s", err)
emitErr(err) emitErr(err)
case *types.Done: case *types.Done:
imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
} }
}) })
} }

View File

@ -38,7 +38,7 @@ func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) {
} else { } else {
<-done <-done
imapw.worker.PostMessage( imapw.worker.PostMessage(
&types.Done{types.RespondTo(msg)}, nil) &types.Done{Message: types.RespondTo(msg)}, nil)
} }
} }

View File

@ -14,7 +14,7 @@ func (imapw *IMAPWorker) handleCopyMessages(msg *types.CopyMessages) {
Error: err, Error: err,
}, nil) }, nil)
} else { } else {
imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
} }
} }
@ -39,6 +39,6 @@ func (imapw *IMAPWorker) handleAppendMessage(msg *types.AppendMessage) {
Error: err, Error: err,
}, nil) }, nil)
} else { } else {
imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
} }
} }

View File

@ -19,7 +19,7 @@ func (imapw *IMAPWorker) handleOpenDirectory(msg *types.OpenDirectory) {
Error: err, Error: err,
}, nil) }, nil)
} else { } else {
imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
} }
} }
@ -67,7 +67,7 @@ func (imapw *IMAPWorker) handleFetchDirectoryContents(
Message: types.RespondTo(msg), Message: types.RespondTo(msg),
Uids: uids, Uids: uids,
}, nil) }, nil)
imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
} }
} }
@ -89,7 +89,7 @@ func translateSortCriterions(
result := make([]sortthread.SortCriterion, 0, len(cs)) result := make([]sortthread.SortCriterion, 0, len(cs))
for _, c := range cs { for _, c := range cs {
if f, ok := sortFieldMap[c.Field]; ok { if f, ok := sortFieldMap[c.Field]; ok {
result = append(result, sortthread.SortCriterion{f, c.Reverse}) result = append(result, sortthread.SortCriterion{Field: f, Reverse: c.Reverse})
} }
} }
return result return result
@ -117,7 +117,7 @@ func (imapw *IMAPWorker) handleDirectoryThreaded(
Message: types.RespondTo(msg), Message: types.RespondTo(msg),
Threads: aercThreads, Threads: aercThreads,
}, nil) }, nil)
imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
} }
} }

View File

@ -14,6 +14,6 @@ func (imapw *IMAPWorker) handleRemoveDirectory(msg *types.RemoveDirectory) {
Error: err, Error: err,
}, nil) }, nil)
} else { } else {
imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
} }
} }

View File

@ -83,7 +83,7 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error {
if w.client != nil && w.client.State() == imap.SelectedState { if w.client != nil && w.client.State() == imap.SelectedState {
w.idleStop = make(chan struct{}) w.idleStop = make(chan struct{})
go func() { go func() {
w.idleDone <- w.client.Idle(w.idleStop, &client.IdleOptions{0, 0}) w.idleDone <- w.client.Idle(w.idleStop, &client.IdleOptions{LogoutTimeout: 0, PollInterval: 0})
}() }()
} }
}() }()
@ -203,7 +203,7 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error {
w.startConnectionObserver() w.startConnectionObserver()
w.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) w.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
case *types.Reconnect: case *types.Reconnect:
if !w.autoReconnect { if !w.autoReconnect {
reterr = fmt.Errorf("auto-reconnect is disabled; run connect to enable it") reterr = fmt.Errorf("auto-reconnect is disabled; run connect to enable it")
@ -225,7 +225,7 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error {
w.startConnectionObserver() w.startConnectionObserver()
w.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) w.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
case *types.Disconnect: case *types.Disconnect:
w.autoReconnect = false w.autoReconnect = false
w.stopConnectionObserver() w.stopConnectionObserver()
@ -238,7 +238,7 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error {
reterr = err reterr = err
break break
} }
w.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) w.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
case *types.ListDirectories: case *types.ListDirectories:
w.handleListDirectories(msg) w.handleListDirectories(msg)
case *types.OpenDirectory: case *types.OpenDirectory:

View File

@ -236,7 +236,7 @@ func MessageInfo(raw RawMessage) (*models.MessageInfo, error) {
} else if err != nil { } else if err != nil {
return nil, fmt.Errorf("could not get structure: %v", err) return nil, fmt.Errorf("could not get structure: %v", err)
} }
h := &mail.Header{msg.Header} h := &mail.Header{Header: msg.Header}
env, err := parseEnvelope(h) env, err := parseEnvelope(h)
if err != nil && !errors.Is(err, DateParseError) { if err != nil && !errors.Is(err, DateParseError) {
return nil, fmt.Errorf("could not parse envelope: %v", err) return nil, fmt.Errorf("could not parse envelope: %v", err)
@ -265,7 +265,7 @@ func MessageInfo(raw RawMessage) (*models.MessageInfo, error) {
Flags: flags, Flags: flags,
Labels: labels, Labels: labels,
InternalDate: recDate, InternalDate: recDate,
RFC822Headers: &mail.Header{msg.Header}, RFC822Headers: &mail.Header{Header: msg.Header},
Size: 0, Size: 0,
Uid: raw.UID(), Uid: raw.UID(),
Error: parseErr, Error: parseErr,

View File

@ -112,7 +112,7 @@ func (w *Worker) handleFSEvent(ev fsnotify.Event) {
} }
func (w *Worker) done(msg types.WorkerMessage) { func (w *Worker) done(msg types.WorkerMessage) {
w.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) w.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil)
} }
func (w *Worker) err(msg types.WorkerMessage, err error) { func (w *Worker) err(msg types.WorkerMessage, err error) {