aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/parser
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-05-22 16:17:51 +0200
committerDaniel Gultsch <daniel@gultsch.de>2014-05-28 10:41:55 +0200
commitb605577cd912e9974263b53f65d0614821403680 (patch)
tree34ed850c30e4a504de785c302b128bdd2013392b /src/eu/siacs/conversations/parser
parentfd4897e1a5a843c8b55b28b00afa6778b345c9a5 (diff)
encrypted group messages are now properly decrypted
Diffstat (limited to 'src/eu/siacs/conversations/parser')
-rw-r--r--src/eu/siacs/conversations/parser/MessageParser.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java
index 3733767f..2ccbe05c 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;
}
}