diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2014-05-22 16:17:51 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2014-05-28 10:41:55 +0200 |
commit | b605577cd912e9974263b53f65d0614821403680 (patch) | |
tree | 34ed850c30e4a504de785c302b128bdd2013392b /src/eu | |
parent | fd4897e1a5a843c8b55b28b00afa6778b345c9a5 (diff) |
encrypted group messages are now properly decrypted
Diffstat (limited to 'src/eu')
-rw-r--r-- | src/eu/siacs/conversations/parser/MessageParser.java | 17 | ||||
-rw-r--r-- | src/eu/siacs/conversations/services/XmppConnectionService.java | 1 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java index 3733767f9..2ccbe05c6 100644 --- a/src/eu/siacs/conversations/parser/MessageParser.java +++ b/src/eu/siacs/conversations/parser/MessageParser.java @@ -120,7 +120,12 @@ public class MessageParser { } else { status = Message.STATUS_RECIEVED; } - return new Message(conversation, counterPart, packet.getBody(), Message.ENCRYPTION_NONE, status); + String pgpBody = getPgpBody(packet); + if (pgpBody==null) { + return new Message(conversation, counterPart, packet.getBody(), Message.ENCRYPTION_NONE, status); + } else { + return new Message(conversation, counterPart, pgpBody, Message.ENCRYPTION_PGP, status); + } } public Message parseCarbonMessage(MessagePacket packet,Account account) { @@ -160,11 +165,11 @@ public class MessageParser { } public String getPgpBody(MessagePacket packet) { - for(Element child : packet.getChildren()) { - if (child.getName().equals("x")&&child.getAttribute("xmlns").equals("jabber:x:encrypted")) { - return child.getContent(); - } + Element child = packet.findChild("x", "jabber:x:encrypted"); + if (child==null) { + return null; + } else { + return child.getContent(); } - return null; } } diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 3347ea1f9..d1692a440 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -873,7 +873,6 @@ public class XmppConnectionService extends Service { packet.setBody(message.getBody()); packet.setTo(message.getCounterpart().split("/")[0]); packet.setFrom(account.getJid()); - packet.addChild("x", "jabber:x:encrypted").setContent("test"); } packet.setId(message.getUuid()); return packet; |