forked from Silverfish/proton-bridge
GODT-1910: fix GUI not being notified of SMTP SSL being turned on by ConfigureAppleMail.
This commit is contained in:
@ -670,12 +670,7 @@ func (s *Service) SetMailServerSettings(_ context.Context, settings *ImapSmtpSet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = s.SendEvent(NewMailServerSettingsChangedEvent(&ImapSmtpSettings{
|
_ = s.SendEvent(NewMailServerSettingsChangedEvent(s.getMailServerSettings()))
|
||||||
ImapPort: int32(s.bridge.GetIMAPPort()),
|
|
||||||
SmtpPort: int32(s.bridge.GetSMTPPort()),
|
|
||||||
UseSSLForImap: s.bridge.GetIMAPSSL(),
|
|
||||||
UseSSLForSmtp: s.bridge.GetSMTPSSL(),
|
|
||||||
}))
|
|
||||||
|
|
||||||
return &emptypb.Empty{}, nil
|
return &emptypb.Empty{}, nil
|
||||||
}
|
}
|
||||||
@ -744,3 +739,12 @@ func base64Decode(in []byte) ([]byte, error) {
|
|||||||
|
|
||||||
return out[:n], nil
|
return out[:n], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Service) getMailServerSettings() *ImapSmtpSettings {
|
||||||
|
return &ImapSmtpSettings{
|
||||||
|
ImapPort: int32(s.bridge.GetIMAPPort()),
|
||||||
|
SmtpPort: int32(s.bridge.GetSMTPPort()),
|
||||||
|
UseSSLForImap: s.bridge.GetIMAPSSL(),
|
||||||
|
UseSSLForSmtp: s.bridge.GetSMTPSSL(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -131,10 +131,17 @@ func (s *Service) RemoveUser(ctx context.Context, userID *wrapperspb.StringValue
|
|||||||
func (s *Service) ConfigureUserAppleMail(ctx context.Context, request *ConfigureAppleMailRequest) (*emptypb.Empty, error) {
|
func (s *Service) ConfigureUserAppleMail(ctx context.Context, request *ConfigureAppleMailRequest) (*emptypb.Empty, error) {
|
||||||
s.log.WithField("UserID", request.UserID).WithField("Address", request.Address).Debug("ConfigureUserAppleMail")
|
s.log.WithField("UserID", request.UserID).WithField("Address", request.Address).Debug("ConfigureUserAppleMail")
|
||||||
|
|
||||||
|
sslWasEnabled := s.bridge.GetSMTPSSL()
|
||||||
|
|
||||||
if err := s.bridge.ConfigureAppleMail(request.UserID, request.Address); err != nil {
|
if err := s.bridge.ConfigureAppleMail(request.UserID, request.Address); err != nil {
|
||||||
s.log.WithField("userID", request.UserID).Error("Cannot configure AppleMail for user")
|
s.log.WithField("userID", request.UserID).Error("Cannot configure AppleMail for user")
|
||||||
return nil, status.Error(codes.Internal, "Apple Mail config failed")
|
return nil, status.Error(codes.Internal, "Apple Mail config failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.bridge.GetSMTPSSL() != sslWasEnabled {
|
||||||
|
// we've changed SMTP SSL settings. This will happen if SSL was off and macOS >= Catalina. We must inform gRPC clients.
|
||||||
|
_ = s.SendEvent(NewMailServerSettingsChangedEvent(s.getMailServerSettings()))
|
||||||
|
}
|
||||||
|
|
||||||
return &emptypb.Empty{}, nil
|
return &emptypb.Empty{}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user