fixed bug with otr session being initilized over and over again
This commit is contained in:
parent
b6e3ce4b20
commit
23e5fb5d56
|
@ -395,13 +395,4 @@ public class Conversation extends AbstractEntity {
|
||||||
public Bookmark getBookmark() {
|
public Bookmark getBookmark() {
|
||||||
return this.bookmark;
|
return this.bookmark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void failWaitingOtrMessages() {
|
|
||||||
for (Message message : this.messages) {
|
|
||||||
if (message.getEncryption() == Message.ENCRYPTION_OTR
|
|
||||||
&& message.getStatus() == Message.STATUS_WAITING) {
|
|
||||||
message.setStatus(Message.STATUS_SEND_FAILED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -519,13 +519,13 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
} else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
|
} else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
|
||||||
message.getConversation().endOtrIfNeeded();
|
message.getConversation().endOtrIfNeeded();
|
||||||
message.getConversation().failWaitingOtrMessages();
|
failWaitingOtrMessages(message.getConversation());
|
||||||
packet = mMessageGenerator.generatePgpChat(message);
|
packet = mMessageGenerator.generatePgpChat(message);
|
||||||
message.setStatus(Message.STATUS_SEND);
|
message.setStatus(Message.STATUS_SEND);
|
||||||
send = true;
|
send = true;
|
||||||
} else {
|
} else {
|
||||||
message.getConversation().endOtrIfNeeded();
|
message.getConversation().endOtrIfNeeded();
|
||||||
message.getConversation().failWaitingOtrMessages();
|
failWaitingOtrMessages(message.getConversation());
|
||||||
if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
|
if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
|
||||||
message.setStatus(Message.STATUS_SEND);
|
message.setStatus(Message.STATUS_SEND);
|
||||||
}
|
}
|
||||||
|
@ -1319,6 +1319,15 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void failWaitingOtrMessages(Conversation conversation) {
|
||||||
|
for (Message message : conversation.getMessages()) {
|
||||||
|
if (message.getEncryption() == Message.ENCRYPTION_OTR
|
||||||
|
&& message.getStatus() == Message.STATUS_WAITING) {
|
||||||
|
markMessage(message, Message.STATUS_SEND_FAILED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public SecureRandom getRNG() {
|
public SecureRandom getRNG() {
|
||||||
return this.mRandom;
|
return this.mRandom;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue