From 1cf055d2fdbaa881cfc8ead6b78dc744e9dbe596 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Fri, 20 Jun 2014 17:30:19 +0200 Subject: not working version of otr file transfer --- src/eu/siacs/conversations/parser/MessageParser.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/eu/siacs/conversations/parser') diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java index fdd7db642..a435d055d 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); -- cgit v1.2.3