aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-07-23 18:04:29 +0200
committeriNPUTmice <daniel@gultsch.de>2014-07-23 18:04:29 +0200
commit23e5fb5d5643ef915fda4819d3786e245cfcea88 (patch)
tree83f74ab2e32f6ecdd94a9273765662888ae43520
parentb6e3ce4b2037b337e4e245411d8b25d61823a6c7 (diff)
fixed bug with otr session being initilized over and over again
-rw-r--r--src/eu/siacs/conversations/entities/Conversation.java9
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java13
2 files changed, 11 insertions, 11 deletions
diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java
index 83ea8931..76fe84cf 100644
--- a/src/eu/siacs/conversations/entities/Conversation.java
+++ b/src/eu/siacs/conversations/entities/Conversation.java
@@ -395,13 +395,4 @@ public class Conversation extends AbstractEntity {
public Bookmark getBookmark() {
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);
- }
- }
- }
}
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index 155478b1..5d4064ea 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -519,13 +519,13 @@ public class XmppConnectionService extends Service {
}
} else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
message.getConversation().endOtrIfNeeded();
- message.getConversation().failWaitingOtrMessages();
+ failWaitingOtrMessages(message.getConversation());
packet = mMessageGenerator.generatePgpChat(message);
message.setStatus(Message.STATUS_SEND);
send = true;
} else {
message.getConversation().endOtrIfNeeded();
- message.getConversation().failWaitingOtrMessages();
+ failWaitingOtrMessages(message.getConversation());
if (message.getConversation().getMode() == Conversation.MODE_SINGLE) {
message.setStatus(Message.STATUS_SEND);
}
@@ -1318,6 +1318,15 @@ public class XmppConnectionService extends Service {
this.sendMessagePacket(conversation.getAccount(), mMessageGenerator.confirm(account, to, id));
}
}
+
+ 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() {
return this.mRandom;