Other(refactor): Remove unencrypted recipient confirmation

This commit is contained in:
James Houlahan
2022-08-19 16:15:51 +02:00
committed by Jakub
parent 4c52a12507
commit 310c6a1ccf
12 changed files with 17 additions and 332 deletions

View File

@ -22,13 +22,10 @@ import (
"time"
"github.com/ProtonMail/proton-bridge/v2/internal/bridge"
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
"github.com/ProtonMail/proton-bridge/v2/internal/users"
"github.com/ProtonMail/proton-bridge/v2/pkg/confirmer"
"github.com/ProtonMail/proton-bridge/v2/pkg/listener"
goSMTPBackend "github.com/emersion/go-smtp"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
type panicHandler interface {
@ -44,7 +41,6 @@ type smtpBackend struct {
eventListener listener.Listener
settings settingsProvider
bridge bridger
confirmer *confirmer.Confirmer
sendRecorder *sendRecorder
}
@ -69,7 +65,6 @@ func newSMTPBackend(
eventListener: eventListener,
settings: settings,
bridge: bridge,
confirmer: confirmer.New(),
sendRecorder: newSendRecorder(),
}
}
@ -116,13 +111,3 @@ func (sb *smtpBackend) AnonymousLogin(_ *goSMTPBackend.ConnectionState) (goSMTPB
return nil, errors.New("anonymous login not supported")
}
func (sb *smtpBackend) shouldReportOutgoingNoEnc() bool {
return sb.settings.GetBool(settings.ReportOutgoingNoEncKey)
}
func (sb *smtpBackend) ConfirmNoEncryption(messageID string, shouldSend bool) {
if err := sb.confirmer.SetResult(messageID, shouldSend); err != nil {
logrus.WithError(err).Error("Failed to set confirmation value")
}
}