aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2015-07-21 11:46:51 +0200
committerDaniel Gultsch <daniel@gultsch.de>2015-07-21 11:46:56 +0200
commitf74ee765a2cb54b163140ca482c710af0f68b101 (patch)
treeda98a9829913a37def43bc387bbef3c26899c53f /src/main
parent74e05023b4f884b31876357c013513c51aff5369 (diff)
bugfix: changed condition of onOtrSessionEstablished being called
fixed #1263 fixed #1260 fixed #1293
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java12
1 files 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 38e0f98a..0d0dce49 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -70,18 +70,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)) {