forked from Silverfish/proton-bridge
fix: allow overriding sign via contact settings if set
This commit is contained in:
@ -95,9 +95,8 @@ func (b *sendPreferencesBuilder) shouldEncrypt() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (b *sendPreferencesBuilder) withSign() {
|
||||
v := true
|
||||
b.sign = &v
|
||||
func (b *sendPreferencesBuilder) withSign(sign bool) {
|
||||
b.sign = &sign
|
||||
}
|
||||
|
||||
func (b *sendPreferencesBuilder) withSignDefault() {
|
||||
@ -258,7 +257,7 @@ func (b *sendPreferencesBuilder) setInternalPGPSettings(
|
||||
|
||||
// We always encrypt and sign internal mail.
|
||||
b.withEncrypt(true)
|
||||
b.withSign()
|
||||
b.withSign(true)
|
||||
|
||||
// We use a custom scheme for internal messages.
|
||||
b.withScheme(pmInternal)
|
||||
@ -369,7 +368,7 @@ func (b *sendPreferencesBuilder) setExternalPGPSettingsWithWKDKeys(
|
||||
|
||||
// We always encrypt and sign external mail if WKD keys are present.
|
||||
b.withEncrypt(true)
|
||||
b.withSign()
|
||||
b.withSign(true)
|
||||
|
||||
// If the contact has a specific Scheme preference, we set it (otherwise we
|
||||
// leave it unset to allow it to be filled in with the default value later).
|
||||
@ -402,13 +401,13 @@ func (b *sendPreferencesBuilder) setExternalPGPSettingsWithoutWKDKeys(
|
||||
) (err error) {
|
||||
b.withEncrypt(vCardData.Encrypt)
|
||||
|
||||
if !vCardData.SignMissing && vCardData.Sign {
|
||||
b.withSign()
|
||||
if vCardData.SignIsSet {
|
||||
b.withSign(vCardData.Sign)
|
||||
}
|
||||
|
||||
// Sign must be enabled whenever encrypt is.
|
||||
if vCardData.Sign || vCardData.Encrypt {
|
||||
b.withSign()
|
||||
if vCardData.Encrypt {
|
||||
b.withSign(true)
|
||||
}
|
||||
|
||||
// If the contact has a specific Scheme preference, we set it (otherwise we
|
||||
@ -479,7 +478,7 @@ func (b *sendPreferencesBuilder) setEncryptionPreferences(mailSettings pmapi.Mai
|
||||
}
|
||||
|
||||
if b.shouldEncrypt() {
|
||||
b.withSign()
|
||||
b.withSign(true)
|
||||
}
|
||||
|
||||
// If undefined, default to the user mail setting "Default PGP scheme".
|
||||
|
||||
Reference in New Issue
Block a user