about summary refs log tree commit diff stats
path: root/worker/imap
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-02-02 08:44:30 -0500
committerDrew DeVault <sir@cmpwn.com>2018-02-02 08:44:30 -0500
commit25f21b55bd3179258f02d5498ecc969ff1ad820a (patch)
tree8d5e84596f3e651bc9ab4649cd755c87771efcea /worker/imap
parentd603bbe2ce4adebfc9ec0bb708d814fd9152676c (diff)
downloadaerc-25f21b55bd3179258f02d5498ecc969ff1ad820a.tar.gz
Tidy up list.go
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)
 		}
 	}()
 }
Kartik Agaram <vc@akkartik.com> 2019-08-26 11:55:26 -0700 committer Kartik Agaram <vc@akkartik.com> 2019-08-26 11:59:21 -0700 5592 - switch register names to lowercase' href='/akkartik/mu/commit/examples/ex4.subx?h=main&id=333525360b22f3d3ea31db46a4d2f1b4edbfebdb'>33352536 ^
9d27e966 ^
33352536 ^
9d27e966 ^
33352536 ^
9d27e966 ^
ecfbbfb5 ^
0c57224c ^
ecfbbfb5 ^
9d27e966 ^
33352536 ^
9d27e966 ^
33352536 ^
9d27e966 ^
33352536 ^
9d27e966 ^
ecfbbfb5 ^
b0f89e4f ^
ecfbbfb5 ^

b0f89e4f ^
ee9a9237 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39