mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 11:42:16 -05:00
Simplify control flow
This commit is contained in:
parent
26eb1f52e5
commit
5c036e2991
@ -98,28 +98,25 @@ public class MessageCryptoHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void decryptOrVerifyNextPartOrStartExtractingTextAndAttachments() {
|
private void decryptOrVerifyNextPartOrStartExtractingTextAndAttachments() {
|
||||||
if (!partsToDecryptOrVerify.isEmpty()) {
|
if (partsToDecryptOrVerify.isEmpty()) {
|
||||||
|
returnResultToFragment();
|
||||||
Part part = partsToDecryptOrVerify.peekFirst();
|
|
||||||
if ("text/plain".equalsIgnoreCase(part.getMimeType())) {
|
|
||||||
startDecryptingOrVerifyingPart(part);
|
|
||||||
} else if (MessageDecryptVerifier.isPgpMimePart(part)) {
|
|
||||||
Multipart multipart = (Multipart) part.getBody();
|
|
||||||
if (multipart == null) {
|
|
||||||
throw new RuntimeException("Downloading missing parts before decryption isn't supported yet");
|
|
||||||
}
|
|
||||||
|
|
||||||
startDecryptingOrVerifyingPart(part);
|
|
||||||
} else {
|
|
||||||
partsToDecryptOrVerify.removeFirst();
|
|
||||||
decryptOrVerifyNextPartOrStartExtractingTextAndAttachments();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnResultToFragment();
|
Part part = partsToDecryptOrVerify.peekFirst();
|
||||||
|
if ("text/plain".equalsIgnoreCase(part.getMimeType())) {
|
||||||
|
startDecryptingOrVerifyingPart(part);
|
||||||
|
} else if (MessageDecryptVerifier.isPgpMimePart(part)) {
|
||||||
|
Multipart multipart = (Multipart) part.getBody();
|
||||||
|
if (multipart == null) {
|
||||||
|
throw new RuntimeException("Downloading missing parts before decryption isn't supported yet");
|
||||||
|
}
|
||||||
|
|
||||||
|
startDecryptingOrVerifyingPart(part);
|
||||||
|
} else {
|
||||||
|
partsToDecryptOrVerify.removeFirst();
|
||||||
|
decryptOrVerifyNextPartOrStartExtractingTextAndAttachments();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startDecryptingOrVerifyingPart(Part part) {
|
private void startDecryptingOrVerifyingPart(Part part) {
|
||||||
|
Loading…
Reference in New Issue
Block a user