aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--src/eu/siacs/conversations/entities/Conversation.java16
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java2
3 files changed, 20 insertions, 1 deletions
diff --git a/README.md b/README.md
index 6ea10e66..a9f96b4f 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,9 @@ These XEPs are - as of now:
* [Andreas Straub](https://github.com/strb)
* [Alethea Butler](https://github.com/alethea)
+###Logo
+* [Diego Turtulici](https://github.com/diesys)
+
###Translations
* [Sergio Cárdenas](https://github.com/kruks23) (Spanish)
* [Benoit Bouvarel](https://github.com/BenoitBouvarel) (French)
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java
index 640d89e9..3379e11d 100644
--- a/src/eu/siacs/conversations/entities/Conversation.java
+++ b/src/eu/siacs/conversations/entities/Conversation.java
@@ -64,6 +64,8 @@ public class Conversation extends AbstractEntity {
private byte[] symmetricKey;
+ private boolean otrSessionNeedsStarting = false;
+
public Conversation(String name, Account account, String contactJid,
int mode) {
this(java.util.UUID.randomUUID().toString(), name, null, account
@@ -237,7 +239,10 @@ public class Conversation extends AbstractEntity {
try {
if (sendStart) {
this.otrSession.startSession();
+ this.otrSessionNeedsStarting = false;
return this.otrSession;
+ } else {
+ this.otrSessionNeedsStarting = true;
}
return this.otrSession;
} catch (OtrException e) {
@@ -252,9 +257,20 @@ public class Conversation extends AbstractEntity {
}
public void resetOtrSession() {
+ this.otrSessionNeedsStarting = false;
this.otrSession = null;
}
+ public void startOtrIfNeeded() {
+ if (this.otrSession != null && this.otrSessionNeedsStarting) {
+ try {
+ this.otrSession.startSession();
+ } catch (OtrException e) {
+ this.resetOtrSession();
+ }
+ }
+ }
+
public void endOtrIfNeeded() {
if (this.otrSession != null) {
if (this.otrSession.getSessionStatus() == SessionStatus.ENCRYPTED) {
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index f71a6d78..35bc2603 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -235,7 +235,7 @@ public class XmppConnectionService extends Service {
List<Conversation> conversations = getConversations();
for (int i = 0; i < conversations.size(); ++i) {
if (conversations.get(i).getAccount() == account) {
- conversations.get(i).endOtrIfNeeded();
+ conversations.get(i).startOtrIfNeeded();
sendUnsendMessages(conversations.get(i));
}
}