aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/entities/Conversation.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-03-21 23:09:14 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-03-21 23:09:14 +0100
commitee1c9e611b011495f1587f5d07c464650b5749d5 (patch)
tree03d8e606636bfbe10f99e3397abc72b96a11bece /src/eu/siacs/conversations/entities/Conversation.java
parent17960c0526902be5eac2fe6ec098c300928305c4 (diff)
more otr fixes
Diffstat (limited to 'src/eu/siacs/conversations/entities/Conversation.java')
-rw-r--r--src/eu/siacs/conversations/entities/Conversation.java30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java
index a13d4ea6..79757f1e 100644
--- a/src/eu/siacs/conversations/entities/Conversation.java
+++ b/src/eu/siacs/conversations/entities/Conversation.java
@@ -218,22 +218,32 @@ public class Conversation extends AbstractEntity {
this.mode = mode;
}
- public void startOtrSession(Context context, String presence) {
- SessionID sessionId = new SessionID(this.getContactJid(), presence,
- "xmpp");
- this.otrSession = new SessionImpl(sessionId, getAccount().getOtrEngine(
- context));
- try {
- this.otrSession.startSession();
- } catch (OtrException e) {
- Log.d("xmppServic", "couldnt start otr");
+ public SessionImpl startOtrSession(Context context, String presence, boolean sendStart) {
+ if (this.otrSession != null) {
+ return this.otrSession;
+ } else {
+ SessionID sessionId = new SessionID(this.getContactJid(), presence,
+ "xmpp");
+ this.otrSession = new SessionImpl(sessionId, getAccount().getOtrEngine(
+ context));
+ try {
+ if (sendStart) {
+ this.otrSession.startSession();
+ return this.otrSession;
+ }
+ return this.otrSession;
+ } catch (OtrException e) {
+ Log.d("xmppServic", "couldnt start otr");
+ return null;
+ }
}
+
}
public SessionImpl getOtrSession() {
return this.otrSession;
}
-
+
public void resetOtrSession() {
this.otrSession = null;
}