aerc

Working clone of aerc-mail.org
git clone git://git.danielmoch.com/aerc.git
Log | Files | Refs | README | LICENSE

commit 25f21b55bd3179258f02d5498ecc969ff1ad820a
parent d603bbe2ce4adebfc9ec0bb708d814fd9152676c
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri,  2 Feb 2018 08:44:30 -0500

Tidy up list.go

Diffstat:
Mworker/imap/list.go | 37+++++++++++++++----------------------
1 file changed, 15 insertions(+), 22 deletions(-)

diff --git a/worker/imap/list.go b/worker/imap/list.go @@ -14,28 +14,21 @@ func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) { done <- imapw.client.List("", "*", mailboxes) }() go func() { - for { - select { - case err := <-done: - if err != nil { - imapw.worker.PostMessage(&types.Error{ - Message: types.RespondTo(msg), - Error: err, - }, nil) - } else { - imapw.worker.PostMessage( - &types.Done{types.RespondTo(msg)}, nil) - } - return - case mbox := <-mailboxes: - if mbox != nil { - imapw.worker.PostMessage(&types.Directory{ - Message: types.RespondTo(msg), - Name: mbox.Name, - Attributes: mbox.Attributes, - }, nil) - } - } + for mbox := range mailboxes { + imapw.worker.PostMessage(&types.Directory{ + Message: types.RespondTo(msg), + Name: mbox.Name, + Attributes: mbox.Attributes, + }, nil) + } + if err := <-done; err != nil { + imapw.worker.PostMessage(&types.Error{ + Message: types.RespondTo(msg), + Error: err, + }, nil) + } else { + imapw.worker.PostMessage( + &types.Done{types.RespondTo(msg)}, nil) } }() }