encrypted group messages are now properly decrypted
This commit is contained in:
parent
fd4897e1a5
commit
b605577cd9
|
@ -120,7 +120,12 @@ public class MessageParser {
|
||||||
} else {
|
} else {
|
||||||
status = Message.STATUS_RECIEVED;
|
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) {
|
public Message parseCarbonMessage(MessagePacket packet,Account account) {
|
||||||
|
@ -160,11 +165,11 @@ public class MessageParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPgpBody(MessagePacket packet) {
|
public String getPgpBody(MessagePacket packet) {
|
||||||
for(Element child : packet.getChildren()) {
|
Element child = packet.findChild("x", "jabber:x:encrypted");
|
||||||
if (child.getName().equals("x")&&child.getAttribute("xmlns").equals("jabber:x:encrypted")) {
|
if (child==null) {
|
||||||
return child.getContent();
|
return null;
|
||||||
}
|
} else {
|
||||||
|
return child.getContent();
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -873,7 +873,6 @@ public class XmppConnectionService extends Service {
|
||||||
packet.setBody(message.getBody());
|
packet.setBody(message.getBody());
|
||||||
packet.setTo(message.getCounterpart().split("/")[0]);
|
packet.setTo(message.getCounterpart().split("/")[0]);
|
||||||
packet.setFrom(account.getJid());
|
packet.setFrom(account.getJid());
|
||||||
packet.addChild("x", "jabber:x:encrypted").setContent("test");
|
|
||||||
}
|
}
|
||||||
packet.setId(message.getUuid());
|
packet.setId(message.getUuid());
|
||||||
return packet;
|
return packet;
|
||||||
|
|
Loading…
Reference in New Issue