fix(orchestrator): reuse src connection to list folders instead of extra TestLogin
This commit is contained in:
@@ -2,8 +2,23 @@ package imapx
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/emersion/go-imap/v2/imapclient"
|
||||
)
|
||||
|
||||
// ListFolders returns the mailbox names visible on an already-connected, logged-in client.
|
||||
func ListFolders(c *imapclient.Client) ([]string, error) {
|
||||
mboxes, err := c.List("", "*", nil).Collect()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
names := make([]string, 0, len(mboxes))
|
||||
for _, m := range mboxes {
|
||||
names = append(names, m.Mailbox)
|
||||
}
|
||||
return names, nil
|
||||
}
|
||||
|
||||
func TestLogin(ctx context.Context, ep Endpoint, login, pass string) ([]string, error) {
|
||||
c, err := Connect(ctx, ep)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user