aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/parser
diff options
context:
space:
mode:
authorfiaxh <github@lightrise.org>2015-10-15 23:21:47 +0100
committerfiaxh <github@lightrise.org>2015-10-28 19:57:11 +0000
commit29a849cb92c0dc902acd3aa54d0d2f07583bce72 (patch)
treef24dc3bfb5258c95a570d8ee54ca18b057d34602 /src/main/java/eu/siacs/conversations/parser
parentd65273ce39ab112ba95d0b852cda6717dbf33c8c (diff)
Decrypt PGP messages in background
Diffstat (limited to 'src/main/java/eu/siacs/conversations/parser')
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index e39df085..c534a417 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -3,6 +3,7 @@ package eu.siacs.conversations.parser;
import android.util.Log;
import android.util.Pair;
+import eu.siacs.conversations.crypto.PgpDecryptionService;
import net.java.otr4j.session.Session;
import net.java.otr4j.session.SessionStatus;
@@ -114,6 +115,13 @@ 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;
@@ -337,7 +345,7 @@ public class MessageParser extends AbstractParser implements
message = new Message(conversation, body, Message.ENCRYPTION_NONE, status);
}
} else if (pgpEncrypted != null) {
- message = new Message(conversation, pgpEncrypted, Message.ENCRYPTION_PGP, status);
+ message = parsePGPChat(conversation, pgpEncrypted, status);
} else if (axolotlEncrypted != null) {
message = parseAxolotlChat(axolotlEncrypted, from, remoteMsgId, conversation, status);
if (message == null) {