From e30bd324a3552fae3089110d39b61ddced66ddee Mon Sep 17 00:00:00 2001 From: Moritz Poldrack Date: Fri, 18 Mar 2022 09:53:02 +0100 Subject: [PATCH] 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 Acked-by: Robin Jarry --- widgets/account-wizard.go | 98 +++++++++++++++++++-------------------- widgets/account.go | 6 +-- widgets/aerc.go | 16 +++---- widgets/compose.go | 22 ++++----- widgets/msgviewer.go | 18 +++---- worker/imap/create.go | 2 +- worker/imap/fetch.go | 6 +-- worker/imap/flags.go | 6 +-- worker/imap/list.go | 2 +- worker/imap/movecopy.go | 4 +- worker/imap/open.go | 8 ++-- worker/imap/remove.go | 2 +- worker/imap/worker.go | 8 ++-- worker/lib/parse.go | 4 +- worker/maildir/worker.go | 2 +- 15 files changed, 102 insertions(+), 102 deletions(-) diff --git a/widgets/account-wizard.go b/widgets/account-wizard.go index 5c15a11..1645d45 100644 --- a/widgets/account-wizard.go +++ b/widgets/account-wizard.go @@ -136,18 +136,18 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard { }) basics := ui.NewGrid().Rows([]ui.GridSpec{ - {ui.SIZE_EXACT, ui.Const(8)}, // Introduction - {ui.SIZE_EXACT, ui.Const(1)}, // Account name (label) - {ui.SIZE_EXACT, ui.Const(1)}, // (input) - {ui.SIZE_EXACT, ui.Const(1)}, // Padding - {ui.SIZE_EXACT, ui.Const(1)}, // Full name (label) - {ui.SIZE_EXACT, ui.Const(1)}, // (input) - {ui.SIZE_EXACT, ui.Const(1)}, // Padding - {ui.SIZE_EXACT, ui.Const(1)}, // Email address (label) - {ui.SIZE_EXACT, ui.Const(1)}, // (input) - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_EXACT, Size: ui.Const(8)}, // Introduction + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Account name (label) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Full name (label) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Email address (label) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input) + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }).Columns([]ui.GridSpec{ - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }) basics.AddChild( 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{ - {ui.SIZE_EXACT, ui.Const(3)}, // Introduction - {ui.SIZE_EXACT, ui.Const(1)}, // Username (label) - {ui.SIZE_EXACT, ui.Const(1)}, // (input) - {ui.SIZE_EXACT, ui.Const(1)}, // Padding - {ui.SIZE_EXACT, ui.Const(1)}, // Password (label) - {ui.SIZE_EXACT, ui.Const(1)}, // (input) - {ui.SIZE_EXACT, ui.Const(1)}, // Padding - {ui.SIZE_EXACT, ui.Const(1)}, // Server (label) - {ui.SIZE_EXACT, ui.Const(1)}, // (input) - {ui.SIZE_EXACT, ui.Const(1)}, // Padding - {ui.SIZE_EXACT, ui.Const(1)}, // Connection mode (label) - {ui.SIZE_EXACT, ui.Const(2)}, // (input) - {ui.SIZE_EXACT, ui.Const(1)}, // Padding - {ui.SIZE_EXACT, ui.Const(1)}, // Connection string - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_EXACT, Size: ui.Const(3)}, // Introduction + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Username (label) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Password (label) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Server (label) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Connection mode (label) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(2)}, // (input) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Connection string + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }).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)", conf.Ui.GetStyle(config.STYLE_DEFAULT))) @@ -291,26 +291,26 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard { }) outgoing := ui.NewGrid().Rows([]ui.GridSpec{ - {ui.SIZE_EXACT, ui.Const(3)}, // Introduction - {ui.SIZE_EXACT, ui.Const(1)}, // Username (label) - {ui.SIZE_EXACT, ui.Const(1)}, // (input) - {ui.SIZE_EXACT, ui.Const(1)}, // Padding - {ui.SIZE_EXACT, ui.Const(1)}, // Password (label) - {ui.SIZE_EXACT, ui.Const(1)}, // (input) - {ui.SIZE_EXACT, ui.Const(1)}, // Padding - {ui.SIZE_EXACT, ui.Const(1)}, // Server (label) - {ui.SIZE_EXACT, ui.Const(1)}, // (input) - {ui.SIZE_EXACT, ui.Const(1)}, // Padding - {ui.SIZE_EXACT, ui.Const(1)}, // Connection mode (label) - {ui.SIZE_EXACT, ui.Const(2)}, // (input) - {ui.SIZE_EXACT, ui.Const(1)}, // Padding - {ui.SIZE_EXACT, ui.Const(1)}, // Connection string - {ui.SIZE_EXACT, ui.Const(1)}, // Padding - {ui.SIZE_EXACT, ui.Const(1)}, // Copy to sent (label) - {ui.SIZE_EXACT, ui.Const(2)}, // (input) - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_EXACT, Size: ui.Const(3)}, // Introduction + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Username (label) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Password (label) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Server (label) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // (input) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Connection mode (label) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(2)}, // (input) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Connection string + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Padding + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Copy to sent (label) + {Strategy: ui.SIZE_EXACT, Size: ui.Const(2)}, // (input) + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }).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)", conf.Ui.GetStyle(config.STYLE_DEFAULT))) @@ -387,10 +387,10 @@ func NewAccountWizard(conf *config.AercConfig, aerc *Aerc) *AccountWizard { }) complete := ui.NewGrid().Rows([]ui.GridSpec{ - {ui.SIZE_EXACT, ui.Const(7)}, // Introduction - {ui.SIZE_WEIGHT, ui.Const(1)}, // Previous / Finish / Finish & open tutorial + {Strategy: ui.SIZE_EXACT, Size: ui.Const(7)}, // Introduction + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, // Previous / Finish / Finish & open tutorial }).Columns([]ui.GridSpec{ - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }) complete.AddChild(ui.NewText( "\nConfiguration complete!\n\n"+ diff --git a/widgets/account.go b/widgets/account.go index e8bda3f..87a8cef 100644 --- a/widgets/account.go +++ b/widgets/account.go @@ -58,12 +58,12 @@ func NewAccountView(aerc *Aerc, conf *config.AercConfig, acct *config.AccountCon } view.grid = ui.NewGrid().Rows([]ui.GridSpec{ - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }).Columns([]ui.GridSpec{ - {ui.SIZE_EXACT, func() int { + {Strategy: ui.SIZE_EXACT, Size: func() int { 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) diff --git a/widgets/aerc.go b/widgets/aerc.go index 5dda888..64b872c 100644 --- a/widgets/aerc.go +++ b/widgets/aerc.go @@ -57,11 +57,11 @@ func NewAerc(conf *config.AercConfig, logger *log.Logger, statusbar.Push(statusline) grid := ui.NewGrid().Rows([]ui.GridSpec{ - {ui.SIZE_EXACT, ui.Const(1)}, - {ui.SIZE_WEIGHT, ui.Const(1)}, - {ui.SIZE_EXACT, ui.Const(1)}, + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, }).Columns([]ui.GridSpec{ - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }) grid.AddChild(tabs.TabStrip) 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) text := ui.NewText(s, errstyle).Strategy(ui.TEXT_CENTER) grid := ui.NewGrid().Rows([]ui.GridSpec{ - {ui.SIZE_WEIGHT, ui.Const(1)}, - {ui.SIZE_EXACT, ui.Const(1)}, - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }).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(text).At(1, 0) diff --git a/widgets/compose.go b/widgets/compose.go index 977c4c4..1300229 100644 --- a/widgets/compose.go +++ b/widgets/compose.go @@ -783,14 +783,14 @@ func (c *Composer) updateGrid() { if c.grid == nil { 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{ - {ui.SIZE_EXACT, ui.Const(height)}, - {ui.SIZE_EXACT, ui.Const(1)}, - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_EXACT, Size: ui.Const(height)}, + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }) if c.heditors != nil { @@ -979,21 +979,21 @@ func newReviewMessage(composer *Composer, err error) *reviewMessage { } 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++ { - 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{ui.SIZE_EXACT, ui.Const(1)}) + spec = append(spec, ui.GridSpec{Strategy: ui.SIZE_EXACT, Size: ui.Const(2)}) + spec = append(spec, ui.GridSpec{Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}) 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 - 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{ - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }) uiConfig := composer.config.Ui diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index 9771a90..9b40ded 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -71,7 +71,7 @@ func NewMessageViewer(acct *AccountView, ) rows := []ui.GridSpec{ - {ui.SIZE_EXACT, ui.Const(headerHeight)}, + {Strategy: ui.SIZE_EXACT, Size: ui.Const(headerHeight)}, } if msg.PGPDetails() != nil { @@ -79,16 +79,16 @@ func NewMessageViewer(acct *AccountView, if msg.PGPDetails().IsSigned && msg.PGPDetails().IsEncrypted { 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{ - {ui.SIZE_EXACT, ui.Const(1)}, - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }...) grid := ui.NewGrid().Rows(rows).Columns([]ui.GridSpec{ - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }) switcher := &PartSwitcher{} @@ -539,11 +539,11 @@ func NewPartViewer(acct *AccountView, conf *config.AercConfig, } grid := ui.NewGrid().Rows([]ui.GridSpec{ - {ui.SIZE_EXACT, ui.Const(3)}, // Message - {ui.SIZE_EXACT, ui.Const(1)}, // Selector - {ui.SIZE_WEIGHT, ui.Const(1)}, + {Strategy: ui.SIZE_EXACT, Size: ui.Const(3)}, // Message + {Strategy: ui.SIZE_EXACT, Size: ui.Const(1)}, // Selector + {Strategy: ui.SIZE_WEIGHT, Size: ui.Const(1)}, }).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"}, diff --git a/worker/imap/create.go b/worker/imap/create.go index 4cc5c5a..5bac001 100644 --- a/worker/imap/create.go +++ b/worker/imap/create.go @@ -14,6 +14,6 @@ func (imapw *IMAPWorker) handleCreateDirectory(msg *types.CreateDirectory) { Error: err, }, nil) } else { - imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) + imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil) } } diff --git a/worker/imap/fetch.go b/worker/imap/fetch.go index 19f4fa3..364fe57 100644 --- a/worker/imap/fetch.go +++ b/worker/imap/fetch.go @@ -46,7 +46,7 @@ func (imapw *IMAPWorker) handleFetchMessageHeaders( }, nil) return nil } - header := &mail.Header{message.Header{textprotoHeader}} + header := &mail.Header{Header: message.Header{Header: textprotoHeader}} imapw.worker.PostMessage(&types.MessageInfo{ Message: types.RespondTo(msg), Info: &models.MessageInfo{ @@ -100,7 +100,7 @@ func (imapw *IMAPWorker) handleFetchMessageBodyPart( 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)) if err != nil { return fmt.Errorf("failed to create message reader: %v", err) @@ -202,5 +202,5 @@ func (imapw *IMAPWorker) handleFetchMessages( return } imapw.worker.PostMessage( - &types.Done{types.RespondTo(msg)}, nil) + &types.Done{Message: types.RespondTo(msg)}, nil) } diff --git a/worker/imap/flags.go b/worker/imap/flags.go index 7ab82f2..cc8a8ce 100644 --- a/worker/imap/flags.go +++ b/worker/imap/flags.go @@ -40,7 +40,7 @@ func (imapw *IMAPWorker) handleDeleteMessages(msg *types.DeleteMessages) { Message: types.RespondTo(msg), Uids: deleted, }, 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) emitErr(err) 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) emitErr(err) case *types.Done: - imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) + imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil) } }) } diff --git a/worker/imap/list.go b/worker/imap/list.go index 9cff2c4..25c247a 100644 --- a/worker/imap/list.go +++ b/worker/imap/list.go @@ -38,7 +38,7 @@ func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) { } else { <-done imapw.worker.PostMessage( - &types.Done{types.RespondTo(msg)}, nil) + &types.Done{Message: types.RespondTo(msg)}, nil) } } diff --git a/worker/imap/movecopy.go b/worker/imap/movecopy.go index 38f23ab..0b19ead 100644 --- a/worker/imap/movecopy.go +++ b/worker/imap/movecopy.go @@ -14,7 +14,7 @@ func (imapw *IMAPWorker) handleCopyMessages(msg *types.CopyMessages) { Error: err, }, nil) } 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, }, nil) } else { - imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) + imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil) } } diff --git a/worker/imap/open.go b/worker/imap/open.go index 2849573..238f1e2 100644 --- a/worker/imap/open.go +++ b/worker/imap/open.go @@ -19,7 +19,7 @@ func (imapw *IMAPWorker) handleOpenDirectory(msg *types.OpenDirectory) { Error: err, }, nil) } 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), Uids: uids, }, 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)) for _, c := range cs { 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 @@ -117,7 +117,7 @@ func (imapw *IMAPWorker) handleDirectoryThreaded( Message: types.RespondTo(msg), Threads: aercThreads, }, nil) - imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) + imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil) } } diff --git a/worker/imap/remove.go b/worker/imap/remove.go index aff36be..688b6a9 100644 --- a/worker/imap/remove.go +++ b/worker/imap/remove.go @@ -14,6 +14,6 @@ func (imapw *IMAPWorker) handleRemoveDirectory(msg *types.RemoveDirectory) { Error: err, }, nil) } else { - imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) + imapw.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil) } } diff --git a/worker/imap/worker.go b/worker/imap/worker.go index 019df8b..6bc850c 100644 --- a/worker/imap/worker.go +++ b/worker/imap/worker.go @@ -83,7 +83,7 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error { if w.client != nil && w.client.State() == imap.SelectedState { w.idleStop = make(chan struct{}) 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.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) + w.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil) case *types.Reconnect: if !w.autoReconnect { 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.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) + w.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil) case *types.Disconnect: w.autoReconnect = false w.stopConnectionObserver() @@ -238,7 +238,7 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error { reterr = err break } - w.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) + w.worker.PostMessage(&types.Done{Message: types.RespondTo(msg)}, nil) case *types.ListDirectories: w.handleListDirectories(msg) case *types.OpenDirectory: diff --git a/worker/lib/parse.go b/worker/lib/parse.go index 6d73a1f..1c0e413 100644 --- a/worker/lib/parse.go +++ b/worker/lib/parse.go @@ -236,7 +236,7 @@ func MessageInfo(raw RawMessage) (*models.MessageInfo, error) { } else if err != nil { 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) if err != nil && !errors.Is(err, DateParseError) { return nil, fmt.Errorf("could not parse envelope: %v", err) @@ -265,7 +265,7 @@ func MessageInfo(raw RawMessage) (*models.MessageInfo, error) { Flags: flags, Labels: labels, InternalDate: recDate, - RFC822Headers: &mail.Header{msg.Header}, + RFC822Headers: &mail.Header{Header: msg.Header}, Size: 0, Uid: raw.UID(), Error: parseErr, diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go index df37291..4a2a19b 100644 --- a/worker/maildir/worker.go +++ b/worker/maildir/worker.go @@ -112,7 +112,7 @@ func (w *Worker) handleFSEvent(ev fsnotify.Event) { } 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) {