aboutsummaryrefslogtreecommitdiffstats
path: root/worker/imap/list.go
diff options
context:
space:
mode:
Diffstat (limited to 'worker/imap/list.go')
-rw-r--r--worker/imap/list.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/worker/imap/list.go b/worker/imap/list.go
index 6aecbca6..5e282ef7 100644
--- a/worker/imap/list.go
+++ b/worker/imap/list.go
@@ -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,