Loading k9mail/src/main/java/com/fsck/k9/activity/compose/ComposeCryptoStatus.java +15 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ public class ComposeCryptoStatus { private CryptoProviderState cryptoProviderState; private CryptoMode cryptoMode; private boolean cryptoSupportSignOnly; private boolean allKeysAvailable; private boolean allKeysVerified; private boolean hasRecipients; Loading Loading @@ -99,6 +100,10 @@ public class ComposeCryptoStatus { return cryptoMode == CryptoMode.OPPORTUNISTIC; } public boolean isOpportunisticSignOnly() { return cryptoSupportSignOnly; } public boolean isSigningEnabled() { return cryptoMode != CryptoMode.DISABLE && signingKeyId != null; } Loading @@ -123,6 +128,7 @@ public class ComposeCryptoStatus { private Long selfEncryptKeyId; private List<Recipient> recipients; private Boolean enablePgpInline; private Boolean cryptoSupportSignOnly; public ComposeCryptoStatusBuilder setCryptoProviderState(CryptoProviderState cryptoProviderState) { this.cryptoProviderState = cryptoProviderState; Loading @@ -134,6 +140,11 @@ public class ComposeCryptoStatus { return this; } public ComposeCryptoStatusBuilder setCryptoSupportSignOnly(boolean cryptoSupportSignOnly) { this.cryptoSupportSignOnly = cryptoSupportSignOnly; return this; } public ComposeCryptoStatusBuilder setSigningKeyId(long signingKeyId) { this.signingKeyId = signingKeyId; return this; Loading Loading @@ -167,6 +178,9 @@ public class ComposeCryptoStatus { if (enablePgpInline == null) { throw new AssertionError("enablePgpInline must be set!"); } if (cryptoSupportSignOnly == null) { throw new AssertionError("supportSignOnly must be set!"); } ArrayList<String> recipientAddresses = new ArrayList<>(); boolean allKeysAvailable = true; Loading @@ -187,6 +201,7 @@ public class ComposeCryptoStatus { ComposeCryptoStatus result = new ComposeCryptoStatus(); result.cryptoProviderState = cryptoProviderState; result.cryptoMode = cryptoMode; result.cryptoSupportSignOnly = cryptoSupportSignOnly; result.recipientAddresses = recipientAddresses.toArray(new String[0]); result.allKeysAvailable = allKeysAvailable; result.allKeysVerified = allKeysVerified; Loading k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java +1 −0 Original line number Diff line number Diff line Loading @@ -354,6 +354,7 @@ public class RecipientPresenter implements PermissionPingCallback { ComposeCryptoStatusBuilder builder = new ComposeCryptoStatusBuilder() .setCryptoProviderState(cryptoProviderState) .setCryptoMode(currentCryptoMode) .setCryptoSupportSignOnly(account.getCryptoSupportSignOnly()) .setEnablePgpInline(cryptoEnablePgpInline) .setRecipients(getAllRecipients()); Loading k9mail/src/main/java/com/fsck/k9/message/PgpMessageBuilder.java +2 −1 Original line number Diff line number Diff line Loading @@ -128,7 +128,8 @@ public class PgpMessageBuilder extends MessageBuilder { return; } if (opportunisticSkipEncryption && !opportunisticSecondPass) { boolean shouldSignOnly = cryptoStatus.isOpportunisticSignOnly(); if (opportunisticSkipEncryption && shouldSignOnly && !opportunisticSecondPass) { opportunisticSecondPass = true; startOrContinueBuildMessage(null); return; Loading k9mail/src/test/java/com/fsck/k9/message/PgpMessageBuilderTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -412,7 +412,8 @@ public class PgpMessageBuilderTest { .setSigningKeyId(TEST_SIGN_KEY_ID) .setSelfEncryptId(TEST_SELF_ENCRYPT_KEY_ID) .setRecipients(new ArrayList<Recipient>()) .setCryptoProviderState(CryptoProviderState.OK); .setCryptoProviderState(CryptoProviderState.OK) .setCryptoSupportSignOnly(true); } private static PgpMessageBuilder createDefaultPgpMessageBuilder(OpenPgpApi openPgpApi) { Loading Loading
k9mail/src/main/java/com/fsck/k9/activity/compose/ComposeCryptoStatus.java +15 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ public class ComposeCryptoStatus { private CryptoProviderState cryptoProviderState; private CryptoMode cryptoMode; private boolean cryptoSupportSignOnly; private boolean allKeysAvailable; private boolean allKeysVerified; private boolean hasRecipients; Loading Loading @@ -99,6 +100,10 @@ public class ComposeCryptoStatus { return cryptoMode == CryptoMode.OPPORTUNISTIC; } public boolean isOpportunisticSignOnly() { return cryptoSupportSignOnly; } public boolean isSigningEnabled() { return cryptoMode != CryptoMode.DISABLE && signingKeyId != null; } Loading @@ -123,6 +128,7 @@ public class ComposeCryptoStatus { private Long selfEncryptKeyId; private List<Recipient> recipients; private Boolean enablePgpInline; private Boolean cryptoSupportSignOnly; public ComposeCryptoStatusBuilder setCryptoProviderState(CryptoProviderState cryptoProviderState) { this.cryptoProviderState = cryptoProviderState; Loading @@ -134,6 +140,11 @@ public class ComposeCryptoStatus { return this; } public ComposeCryptoStatusBuilder setCryptoSupportSignOnly(boolean cryptoSupportSignOnly) { this.cryptoSupportSignOnly = cryptoSupportSignOnly; return this; } public ComposeCryptoStatusBuilder setSigningKeyId(long signingKeyId) { this.signingKeyId = signingKeyId; return this; Loading Loading @@ -167,6 +178,9 @@ public class ComposeCryptoStatus { if (enablePgpInline == null) { throw new AssertionError("enablePgpInline must be set!"); } if (cryptoSupportSignOnly == null) { throw new AssertionError("supportSignOnly must be set!"); } ArrayList<String> recipientAddresses = new ArrayList<>(); boolean allKeysAvailable = true; Loading @@ -187,6 +201,7 @@ public class ComposeCryptoStatus { ComposeCryptoStatus result = new ComposeCryptoStatus(); result.cryptoProviderState = cryptoProviderState; result.cryptoMode = cryptoMode; result.cryptoSupportSignOnly = cryptoSupportSignOnly; result.recipientAddresses = recipientAddresses.toArray(new String[0]); result.allKeysAvailable = allKeysAvailable; result.allKeysVerified = allKeysVerified; Loading
k9mail/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java +1 −0 Original line number Diff line number Diff line Loading @@ -354,6 +354,7 @@ public class RecipientPresenter implements PermissionPingCallback { ComposeCryptoStatusBuilder builder = new ComposeCryptoStatusBuilder() .setCryptoProviderState(cryptoProviderState) .setCryptoMode(currentCryptoMode) .setCryptoSupportSignOnly(account.getCryptoSupportSignOnly()) .setEnablePgpInline(cryptoEnablePgpInline) .setRecipients(getAllRecipients()); Loading
k9mail/src/main/java/com/fsck/k9/message/PgpMessageBuilder.java +2 −1 Original line number Diff line number Diff line Loading @@ -128,7 +128,8 @@ public class PgpMessageBuilder extends MessageBuilder { return; } if (opportunisticSkipEncryption && !opportunisticSecondPass) { boolean shouldSignOnly = cryptoStatus.isOpportunisticSignOnly(); if (opportunisticSkipEncryption && shouldSignOnly && !opportunisticSecondPass) { opportunisticSecondPass = true; startOrContinueBuildMessage(null); return; Loading
k9mail/src/test/java/com/fsck/k9/message/PgpMessageBuilderTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -412,7 +412,8 @@ public class PgpMessageBuilderTest { .setSigningKeyId(TEST_SIGN_KEY_ID) .setSelfEncryptId(TEST_SELF_ENCRYPT_KEY_ID) .setRecipients(new ArrayList<Recipient>()) .setCryptoProviderState(CryptoProviderState.OK); .setCryptoProviderState(CryptoProviderState.OK) .setCryptoSupportSignOnly(true); } private static PgpMessageBuilder createDefaultPgpMessageBuilder(OpenPgpApi openPgpApi) { Loading