From f1ee5cccf0b26e2b533d3ce85a020ba8f2a03b8a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 21 Jul 2015 11:46:51 +0200 Subject: bugfix: changed condition of onOtrSessionEstablished being called fixed #1263 fixed #1260 fixed #1293 --- .../java/eu/siacs/conversations/parser/MessageParser.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index d46ff195..97bacd8c 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -66,18 +66,18 @@ public class MessageParser extends AbstractParser implements try { conversation.setLastReceivedOtrMessageId(id); Session otrSession = conversation.getOtrSession(); - SessionStatus before = otrSession.getSessionStatus(); body = otrSession.transformReceiving(body); - SessionStatus after = otrSession.getSessionStatus(); - if ((before != after) && (after == SessionStatus.ENCRYPTED)) { + SessionStatus status = otrSession.getSessionStatus(); + if (body == null && status == SessionStatus.ENCRYPTED) { conversation.setNextEncryption(Message.ENCRYPTION_OTR); mXmppConnectionService.onOtrSessionEstablished(conversation); - } else if ((before != after) && (after == SessionStatus.FINISHED)) { + return null; + } else if (body == null && status == SessionStatus.FINISHED) { conversation.setNextEncryption(Message.ENCRYPTION_NONE); conversation.resetOtrSession(); mXmppConnectionService.updateConversationUi(); - } - if ((body == null) || (body.isEmpty())) { + return null; + } else if (body == null || (body.isEmpty())) { return null; } if (body.startsWith(CryptoHelper.FILETRANSFER)) { -- cgit v1.2.3