From 29a849cb92c0dc902acd3aa54d0d2f07583bce72 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Thu, 15 Oct 2015 23:21:47 +0100 Subject: Decrypt PGP messages in background --- src/main/java/eu/siacs/conversations/parser/MessageParser.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/main/java/eu/siacs/conversations/parser') 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) { -- cgit v1.2.3