aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/parser
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-01-21 14:40:57 +0100
committerChristian Schneppe <christian@pix-art.de>2018-01-21 14:40:57 +0100
commit89bea337c741d44d03a56457fe29ed5ba365d765 (patch)
tree801a595a226e627b60940b5f4ad3d31d4041af23 /src/main/java/de/pixart/messenger/parser
parent64bee71d95b2e700938c97dbf4a7daf4ee139e1f (diff)
properly handle key transport messages. use prekeyparsing only when that attribute is set
Diffstat (limited to 'src/main/java/de/pixart/messenger/parser')
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java
index f20e3132e..b19b30fa8 100644
--- a/src/main/java/de/pixart/messenger/parser/MessageParser.java
+++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java
@@ -163,24 +163,28 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
return false;
}
- private Message parseAxolotlChat(Element axolotlMessage, Jid from, Conversation conversation, int status) {
- AxolotlService service = conversation.getAccount().getAxolotlService();
- XmppAxolotlMessage xmppAxolotlMessage;
+ private Message parseAxolotlChat(Element axolotlMessage, Jid from, Conversation conversation, int status, boolean postpone) {
+ final AxolotlService service = conversation.getAccount().getAxolotlService();
+ final XmppAxolotlMessage xmppAxolotlMessage;
try {
xmppAxolotlMessage = XmppAxolotlMessage.fromElement(axolotlMessage, from.toBareJid());
} catch (Exception e) {
Log.d(Config.LOGTAG, conversation.getAccount().getJid().toBareJid() + ": invalid omemo message received " + e.getMessage());
return null;
}
- XmppAxolotlMessage.XmppAxolotlPlaintextMessage plaintextMessage = service.processReceivingPayloadMessage(xmppAxolotlMessage);
- if (plaintextMessage != null) {
- Message finishedMessage = new Message(conversation, plaintextMessage.getPlaintext(), Message.ENCRYPTION_AXOLOTL, status);
- finishedMessage.setFingerprint(plaintextMessage.getFingerprint());
- Log.d(Config.LOGTAG, AxolotlService.getLogprefix(finishedMessage.getConversation().getAccount()) + " Received Message with session fingerprint: " + plaintextMessage.getFingerprint());
- return finishedMessage;
+ if (xmppAxolotlMessage.hasPayload()) {
+ final XmppAxolotlMessage.XmppAxolotlPlaintextMessage plaintextMessage = service.processReceivingPayloadMessage(xmppAxolotlMessage, postpone);
+ if (plaintextMessage != null) {
+ Message finishedMessage = new Message(conversation, plaintextMessage.getPlaintext(), Message.ENCRYPTION_AXOLOTL, status);
+ finishedMessage.setFingerprint(plaintextMessage.getFingerprint());
+ Log.d(Config.LOGTAG, AxolotlService.getLogprefix(finishedMessage.getConversation().getAccount()) + " Received Message with session fingerprint: " + plaintextMessage.getFingerprint());
+ return finishedMessage;
+ }
} else {
- return null;
+ Log.d(Config.LOGTAG, conversation.getAccount().getJid().toBareJid() + ": received OMEMO key transport message");
+ service.processReceivingKeyTransportMessage(xmppAxolotlMessage, postpone);
}
+ return null;
}
private class Invite {
@@ -465,7 +469,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
} else {
origin = from;
}
- message = parseAxolotlChat(axolotlEncrypted, origin, conversation, status);
+ message = parseAxolotlChat(axolotlEncrypted, origin, conversation, status, query != null);
if (message == null) {
if (query == null && extractChatState(mXmppConnectionService.find(account, counterpart.toBareJid()), isTypeGroupChat, packet)) {
mXmppConnectionService.updateConversationUi();