aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/parser
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-06-20 17:30:19 +0200
committeriNPUTmice <daniel@gultsch.de>2014-06-20 17:30:19 +0200
commit1cf055d2fdbaa881cfc8ead6b78dc744e9dbe596 (patch)
tree51c0a3463ff3d5f005aeb6dccf6c50d05fddab42 /src/eu/siacs/conversations/parser
parentbeafb06b6a59649a4c314db820f5ce30be120e7c (diff)
not working version of otr file transfer
Diffstat (limited to 'src/eu/siacs/conversations/parser')
-rw-r--r--src/eu/siacs/conversations/parser/MessageParser.java10
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);