aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/parser/MessageParser.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/eu/siacs/conversations/parser/MessageParser.java')
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index c4b63d61..247fd72b 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -117,13 +117,6 @@ public class MessageParser extends AbstractParser implements
return finishedMessage;
}
- private Message parsePGPChat(final Conversation conversation, String pgpEncrypted, int status) {
- final Message message = new Message(conversation, pgpEncrypted, Message.ENCRYPTION_PGP, status);
- PgpDecryptionService pgpDecryptionService = conversation.getAccount().getPgpDecryptionService();
- pgpDecryptionService.add(message);
- return message;
- }
-
private class Invite {
Jid jid;
String password;
@@ -362,7 +355,7 @@ public class MessageParser extends AbstractParser implements
message = new Message(conversation, body, Message.ENCRYPTION_NONE, status);
}
} else if (pgpEncrypted != null) {
- message = parsePGPChat(conversation, pgpEncrypted, status);
+ message = new Message(conversation, pgpEncrypted, Message.ENCRYPTION_PGP, status);
} else if (axolotlEncrypted != null) {
message = parseAxolotlChat(axolotlEncrypted, from, remoteMsgId, conversation, status);
if (message == null) {
@@ -410,6 +403,7 @@ public class MessageParser extends AbstractParser implements
replacedMessage.setBody(message.getBody());
replacedMessage.setEdited(replacedMessage.getRemoteMsgId());
replacedMessage.setRemoteMsgId(remoteMsgId);
+ replacedMessage.setEncryption(message.getEncryption());
if (replacedMessage.getStatus() == Message.STATUS_RECEIVED) {
replacedMessage.markUnread();
}
@@ -417,6 +411,9 @@ public class MessageParser extends AbstractParser implements
if (mXmppConnectionService.confirmMessages() && remoteMsgId != null && !isForwarded && !isTypeGroupChat) {
sendMessageReceipts(account, packet);
}
+ if (replacedMessage.getEncryption() == Message.ENCRYPTION_PGP) {
+ conversation.getAccount().getPgpDecryptionService().add(replacedMessage);
+ }
return;
} else {
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": received message correction but verification didn't check out");
@@ -438,6 +435,10 @@ public class MessageParser extends AbstractParser implements
conversation.add(message);
}
+ if (message.getEncryption() == Message.ENCRYPTION_PGP) {
+ conversation.getAccount().getPgpDecryptionService().add(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);