aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-02-19 21:02:33 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-02-19 21:02:33 +0100
commite6f8b7d9fa30e4e231a07cdbbb225e462893eb3d (patch)
tree178f3984d2836a7f95e33301045e5d1d807ed2ed /src/main/java/eu
parenta2cb009f4cb750a1e2953202852e889f78041c05 (diff)
decrypt pgp message corrections
Diffstat (limited to 'src/main/java/eu')
-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);