aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu')
-rw-r--r--src/eu/siacs/conversations/entities/Conversation.java10
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java17
2 files changed, 11 insertions, 16 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java
index 1a4745f9..aad072cf 100644
--- a/src/eu/siacs/conversations/entities/Conversation.java
+++ b/src/eu/siacs/conversations/entities/Conversation.java
@@ -232,13 +232,17 @@ public class Conversation extends AbstractEntity {
this.otrSession = null;
}
- public void endOtrIfNeeded() throws OtrException {
+ public void endOtrIfNeeded() {
if (this.otrSession!=null) {
if (this.otrSession.getSessionStatus() == SessionStatus.ENCRYPTED) {
- this.otrSession.endSession();
+ try {
+ this.otrSession.endSession();
+ this.resetOtrSession();
+ } catch (OtrException e) {
+ this.resetOtrSession();
+ }
}
}
- this.resetOtrSession();
}
public boolean hasValidOtrSession() {
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index 6d1ce784..2f19b100 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -567,6 +567,7 @@ public class XmppConnectionService extends Service {
saveInDb = true;
addToConversation = true;
} else if (message.getEncryption() == Message.ENCRYPTION_PGP) {
+ message.getConversation().endOtrIfNeeded();
long keyId = message.getConversation().getContact()
.getPgpKeyId();
packet = new MessagePacket();
@@ -586,6 +587,7 @@ public class XmppConnectionService extends Service {
saveInDb = true;
addToConversation = true;
} else {
+ message.getConversation().endOtrIfNeeded();
// don't encrypt
if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
message.setStatus(Message.STATUS_SEND);
@@ -873,13 +875,7 @@ public class XmppConnectionService extends Service {
if (conversation.getMode() == Conversation.MODE_MULTI) {
leaveMuc(conversation);
} else {
- try {
- conversation.endOtrIfNeeded();
- } catch (OtrException e) {
- Log.d(LOGTAG,
- "error ending otr session for "
- + conversation.getName());
- }
+ conversation.endOtrIfNeeded();
}
this.databaseBackend.updateConversation(conversation);
this.conversations.remove(conversation);
@@ -1068,12 +1064,7 @@ public class XmppConnectionService extends Service {
if (conversation.getMode() == Conversation.MODE_MULTI) {
leaveMuc(conversation);
} else {
- try {
- conversation.endOtrIfNeeded();
- } catch (OtrException e) {
- Log.d(LOGTAG, "error ending otr session for "
- + conversation.getName());
- }
+ conversation.endOtrIfNeeded();
}
}
}