diff options
Diffstat (limited to 'src/eu/siacs/conversations/parser/MessageParser.java')
-rw-r--r-- | src/eu/siacs/conversations/parser/MessageParser.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java index fdd7db64..a435d055 100644 --- a/src/eu/siacs/conversations/parser/MessageParser.java +++ b/src/eu/siacs/conversations/parser/MessageParser.java @@ -1,11 +1,13 @@ package eu.siacs.conversations.parser; +import android.util.Log; import net.java.otr4j.session.Session; import net.java.otr4j.session.SessionStatus; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xmpp.stanzas.MessagePacket; @@ -72,11 +74,15 @@ public class MessageParser extends AbstractParser { } else if ((before != after) && (after == SessionStatus.FINISHED)) { conversation.resetOtrSession(); } - // isEmpty is a work around for some weird clients which send emtpty - // strings over otr if ((body == null) || (body.isEmpty())) { return null; } + if (body.startsWith(CryptoHelper.FILETRANSFER)) { + String key = body.substring(CryptoHelper.FILETRANSFER.length()); + conversation.setSymmetricKey(CryptoHelper.hexToBytes(key)); + Log.d("xmppService","new symmetric key: "+CryptoHelper.bytesToHex(conversation.getSymmetricKey())); + return null; + } conversation.setLatestMarkableMessageId(getMarkableMessageId(packet)); Message finishedMessage = new Message(conversation, packet.getFrom(), body, Message.ENCRYPTION_OTR, Message.STATUS_RECIEVED); |