aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/eu/siacs/conversations/parser/MessageParser.java17
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java1
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 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;
}
}
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index 3347ea1f..d1692a44 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;