Shared GUI for Bridge and Import/Export

This commit is contained in:
Jakub
2020-05-27 15:58:50 +02:00
committed by Michal Horejsek
parent b598779c0f
commit 49316a935c
96 changed files with 11469 additions and 209 deletions

View File

@ -21,6 +21,8 @@ import (
"crypto/sha256"
"fmt"
"strings"
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
)
// Mailbox is universal data holder of mailbox details for every provider.
@ -36,6 +38,19 @@ func (m Mailbox) Hash() string {
return fmt.Sprintf("%x", sha256.Sum256([]byte(m.Name)))
}
// LeastUsedColor is intended to return color for creating a new inbox or label
func LeastUsedColor(mailboxes []Mailbox) string {
usedColors := []string{}
if mailboxes != nil {
for _, m := range mailboxes {
usedColors = append(usedColors, m.Color)
}
}
return pmapi.LeastUsedColor(usedColors)
}
// findMatchingMailboxes returns all matching mailboxes from `mailboxes`.
// Only one exclusive mailbox is returned.
func (m Mailbox) findMatchingMailboxes(mailboxes []Mailbox) []Mailbox {