Refactoring

pull/187/head
M66B 4 years ago
parent a9937508ca
commit 795c0840d9

@ -485,11 +485,7 @@ class Core {
db.operation().deleteOperation(op.id);
// Cleanup messages
if (message != null &&
(ex instanceof MessageRemovedException ||
ex instanceof MessageRemovedIOException ||
ex.getCause() instanceof MessageRemovedException ||
ex.getCause() instanceof MessageRemovedIOException))
if (message != null && MessageHelper.isRemoved(ex))
db.message().deleteMessage(message.id);
db.setTransactionSuccessful();

@ -2389,6 +2389,16 @@ public class MessageHelper {
return email;
}
static boolean isRemoved(Throwable ex) {
while (ex != null) {
if (ex instanceof MessageRemovedException ||
ex instanceof MessageRemovedIOException)
return true;
ex = ex.getCause();
}
return false;
}
static boolean equalEmail(Address a1, Address a2) {
String email1 = ((InternetAddress) a1).getAddress();
String email2 = ((InternetAddress) a2).getAddress();

Loading…
Cancel
Save