simplified determination whether otr needs starting in a session
This commit is contained in:
parent
c1a55608df
commit
0fd634ae52
|
@ -72,8 +72,6 @@ public class Conversation extends AbstractEntity {
|
||||||
|
|
||||||
private byte[] symmetricKey;
|
private byte[] symmetricKey;
|
||||||
|
|
||||||
private boolean otrSessionNeedsStarting = false;
|
|
||||||
|
|
||||||
private Bookmark bookmark;
|
private Bookmark bookmark;
|
||||||
|
|
||||||
public Conversation(String name, Account account, String contactJid,
|
public Conversation(String name, Account account, String contactJid,
|
||||||
|
@ -264,10 +262,7 @@ public class Conversation extends AbstractEntity {
|
||||||
try {
|
try {
|
||||||
if (sendStart) {
|
if (sendStart) {
|
||||||
this.otrSession.startSession();
|
this.otrSession.startSession();
|
||||||
this.otrSessionNeedsStarting = false;
|
|
||||||
return this.otrSession;
|
return this.otrSession;
|
||||||
} else {
|
|
||||||
this.otrSessionNeedsStarting = true;
|
|
||||||
}
|
}
|
||||||
return this.otrSession;
|
return this.otrSession;
|
||||||
} catch (OtrException e) {
|
} catch (OtrException e) {
|
||||||
|
@ -283,12 +278,12 @@ public class Conversation extends AbstractEntity {
|
||||||
|
|
||||||
public void resetOtrSession() {
|
public void resetOtrSession() {
|
||||||
this.otrFingerprint = null;
|
this.otrFingerprint = null;
|
||||||
this.otrSessionNeedsStarting = false;
|
|
||||||
this.otrSession = null;
|
this.otrSession = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startOtrIfNeeded() {
|
public void startOtrIfNeeded() {
|
||||||
if (this.otrSession != null && this.otrSessionNeedsStarting) {
|
if (this.otrSession != null
|
||||||
|
&& this.otrSession.getSessionStatus() != SessionStatus.ENCRYPTED) {
|
||||||
try {
|
try {
|
||||||
this.otrSession.startSession();
|
this.otrSession.startSession();
|
||||||
} catch (OtrException e) {
|
} catch (OtrException e) {
|
||||||
|
|
Loading…
Reference in a new issue