~sircmpwn/aerc

3a5b4c229e42c14b1389cd985506d09b3f17388b — Drew DeVault 1 year, 5 months ago e85ef71
Wait for listing to complete before sending Done
1 files changed, 3 insertions(+), 0 deletions(-)

M worker/imap/list.go
M worker/imap/list.go => worker/imap/list.go +3 -0
@@ 9,6 9,7 @@ import (
func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) {
	mailboxes := make(chan *imap.MailboxInfo)
	imapw.worker.Logger.Println("Listing mailboxes")
	done := make(chan interface{})

	go func() {
		for mbox := range mailboxes {


@@ 22,9 23,11 @@ func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) {
				Attributes: mbox.Attributes,
			}, nil)
		}
		done <- nil
	}()

	if err := imapw.client.List("", "*", mailboxes); err != nil {
		<-done
		imapw.worker.PostMessage(&types.Error{
			Message: types.RespondTo(msg),
			Error:   err,