diff --git a/src/main/java/eu/siacs/conversations/crypto/PgpDecryptionService.java b/src/main/java/eu/siacs/conversations/crypto/PgpDecryptionService.java index 73da1fb96..082c7474f 100644 --- a/src/main/java/eu/siacs/conversations/crypto/PgpDecryptionService.java +++ b/src/main/java/eu/siacs/conversations/crypto/PgpDecryptionService.java @@ -64,6 +64,11 @@ public class PgpDecryptionService { this.pendingNotifications.removeAll(discards); } + public synchronized void discard(Message message) { + this.messages.remove(message); + this.pendingNotifications.remove(message); + } + protected synchronized void decryptNext() { if (pendingIntent == null && getOpenPgpApi() != null diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index 1dd8026ba..f965e561f 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -483,6 +483,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece sendMessageReceipts(account, packet); } if (replacedMessage.getEncryption() == Message.ENCRYPTION_PGP) { + conversation.getAccount().getPgpDecryptionService().discard(replacedMessage); conversation.getAccount().getPgpDecryptionService().decrypt(replacedMessage, false); } return;