aboutsummaryrefslogtreecommitdiffstats
path: root/worker/imap/list.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-02-01 19:54:19 -0500
committerDrew DeVault <sir@cmpwn.com>2018-02-01 19:54:19 -0500
commitd603bbe2ce4adebfc9ec0bb708d814fd9152676c (patch)
tree0b6e06a272a68b98608c85b9b6cb21ef04181547 /worker/imap/list.go
parentcc03f6f4c802ee0742520145e9cacbd88f78ed9a (diff)
downloadaerc-d603bbe2ce4adebfc9ec0bb708d814fd9152676c.tar.gz
Refactoring; consume listing response
Diffstat (limited to 'worker/imap/list.go')
-rw-r--r--worker/imap/list.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/worker/imap/list.go b/worker/imap/list.go
index f6d3677a..2f5e5b46 100644
--- a/worker/imap/list.go
+++ b/worker/imap/list.go
@@ -6,7 +6,7 @@ import (
"git.sr.ht/~sircmpwn/aerc2/worker/types"
)
-func (imapw *IMAPWorker) handleListDirectories(msg types.ListDirectories) {
+func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) {
mailboxes := make(chan *imap.MailboxInfo)
done := make(chan error, 1)
imapw.worker.Logger.Println("Listing mailboxes")
@@ -18,18 +18,22 @@ func (imapw *IMAPWorker) handleListDirectories(msg types.ListDirectories) {
select {
case err := <-done:
if err != nil {
- imapw.worker.PostMessage(types.Error{
+ imapw.worker.PostMessage(&types.Error{
Message: types.RespondTo(msg),
Error: err,
}, nil)
} else {
imapw.worker.PostMessage(
- types.Done{types.RespondTo(msg)}, nil)
+ &types.Done{types.RespondTo(msg)}, nil)
}
return
case mbox := <-mailboxes:
if mbox != nil {
- imapw.worker.Logger.Printf("%v\n", mbox.Name)
+ imapw.worker.PostMessage(&types.Directory{
+ Message: types.RespondTo(msg),
+ Name: mbox.Name,
+ Attributes: mbox.Attributes,
+ }, nil)
}
}
}