feat: remove dependency on go-apple-mobileconfig

This commit is contained in:
James Houlahan
2021-02-01 10:35:16 +01:00
parent 35b5b925cf
commit 0069eb9a0c
8 changed files with 239 additions and 26 deletions

View File

@ -28,9 +28,9 @@ import (
"strings"
"time"
mobileconfig "github.com/ProtonMail/go-apple-mobileconfig"
"github.com/ProtonMail/proton-bridge/internal/bridge"
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
"github.com/ProtonMail/proton-bridge/pkg/mobileconfig"
)
func init() { //nolint[gochecknoinit]
@ -66,17 +66,17 @@ func (c *appleMail) Configure(imapPort, smtpPort int, imapSSL, smtpSSL bool, use
EmailAddress: addresses,
DisplayName: displayName,
Identifier: "protonmail " + displayName + timestamp,
Imap: &mobileconfig.Imap{
IMAP: &mobileconfig.IMAP{
Hostname: bridge.Host,
Port: imapPort,
Tls: imapSSL,
TLS: imapSSL,
Username: displayName,
Password: user.GetBridgePassword(),
},
Smtp: &mobileconfig.Smtp{
SMTP: &mobileconfig.SMTP{
Hostname: bridge.Host,
Port: smtpPort,
Tls: smtpSSL,
TLS: smtpSSL,
Username: displayName,
},
}
@ -98,7 +98,7 @@ func (c *appleMail) Configure(imapPort, smtpPort int, imapSSL, smtpSSL bool, use
return err
}
if err := mc.WriteTo(f); err != nil {
if err := mc.WriteOut(f); err != nil {
_ = f.Close()
return err
}