summary refs log tree commit diff stats
path: root/worker/imap
diff options
context:
space:
mode:
Diffstat (limited to 'worker/imap')
-rw-r--r--worker/imap/list.go37
1 files changed, 15 insertions, 22 deletions
diff --git a/worker/imap/list.go b/worker/imap/list.go
index 2f5e5b4..eff3d49 100644
--- 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)
 		}
 	}()
 }
k Agaram <vc@akkartik.com> 2020-12-28 11:09:31 -0800 7440' href='/akkartik/mu/commit/translate_subx_emulated?h=main&id=880464a7d21dc0e2f15c52ef24937d5eca953f2e'>880464a7 ^
531f14c9 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22