diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-06-15 12:44:29 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-06-19 20:02:11 +0200 |
commit | 0435f9278047dae73f1502e30c9978ce91ef9e96 (patch) | |
tree | dca655fd0e38c5f9c520a9f22e167e9cc5a256b1 /src/main/java/eu/siacs/conversations/parser | |
parent | d12a57cbb362d6158c7b4c5f70074b3c829308ea (diff) |
delay notification until after pgp decryption
Diffstat (limited to 'src/main/java/eu/siacs/conversations/parser')
-rw-r--r-- | src/main/java/eu/siacs/conversations/parser/MessageParser.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index 86f96c370..1dd8026ba 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -342,6 +342,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece final Jid to = packet.getTo(); final Jid from = packet.getFrom(); final String remoteMsgId = packet.getId(); + boolean notify = false; if (from == null) { Log.d(Config.LOGTAG,"no from in: "+packet.toString()); @@ -482,7 +483,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece sendMessageReceipts(account, packet); } if (replacedMessage.getEncryption() == Message.ENCRYPTION_PGP) { - conversation.getAccount().getPgpDecryptionService().decrypt(replacedMessage); + conversation.getAccount().getPgpDecryptionService().decrypt(replacedMessage, false); } return; } else { @@ -505,10 +506,6 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece conversation.add(message); } - if (message.getEncryption() == Message.ENCRYPTION_PGP) { - conversation.getAccount().getPgpDecryptionService().decrypt(message); - } - if (query == null || query.getWith() == null) { //either no mam or catchup if (status == Message.STATUS_SEND || status == Message.STATUS_SEND_RECEIVED) { mXmppConnectionService.markRead(conversation); @@ -517,9 +514,14 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece } } else { message.markUnread(); + notify = true; } } + if (message.getEncryption() == Message.ENCRYPTION_PGP) { + notify = conversation.getAccount().getPgpDecryptionService().decrypt(message, notify); + } + if (query == null) { mXmppConnectionService.updateConversationUi(); } @@ -541,7 +543,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece final HttpConnectionManager manager = this.mXmppConnectionService.getHttpConnectionManager(); if (message.trusted() && message.treatAsDownloadable() != Message.Decision.NEVER && manager.getAutoAcceptFileSize() > 0) { manager.createNewDownloadConnection(message); - } else if (!message.isRead()) { + } else if (notify) { if (query == null) { mXmppConnectionService.getNotificationService().push(message); } else if (query.getWith() == null) { // mam catchup |