aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-03-08 00:48:52 +0100
committerDaniel Gultsch <daniel@gultsch.de>2014-03-08 00:48:52 +0100
commita1b72313d7858a69c794d706e7ebb00a50a7000a (patch)
tree8892e42936f6620bd66cfe4c068a4ff3d38ca10c /src/eu
parent5955da3519787bd2b0c6d5b1cc879137f4e946da (diff)
fixed otr bug
Diffstat (limited to 'src/eu')
-rw-r--r--src/eu/siacs/conversations/utils/MessageParser.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/utils/MessageParser.java b/src/eu/siacs/conversations/utils/MessageParser.java
index 65186957..614683a2 100644
--- a/src/eu/siacs/conversations/utils/MessageParser.java
+++ b/src/eu/siacs/conversations/utils/MessageParser.java
@@ -2,6 +2,7 @@ package eu.siacs.conversations.utils;
import java.util.List;
+import net.java.otr4j.OtrException;
import net.java.otr4j.session.Session;
import net.java.otr4j.session.SessionStatus;
import android.util.Log;
@@ -35,6 +36,17 @@ public class MessageParser {
String body = packet.getBody();
if (!conversation.hasValidOtrSession()) {
conversation.startOtrSession(service.getApplicationContext(), fromParts[1]);
+ } else {
+ if (body.startsWith("?OTRv")) {
+ Log.d("xmppService","new otr during existing otr session requested. ending old one");
+ try {
+ conversation.getOtrSession().endSession();
+ } catch (OtrException e) {
+ Log.d("xmppService","couldnt end old session");
+ }
+ Log.d("xmppService","starting new one with "+fromParts[1]);
+ conversation.startOtrSession(service.getApplicationContext(), fromParts[1]);
+ }
}
try {
Session otrSession = conversation.getOtrSession();