aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-12-03 17:05:37 +0100
committeriNPUTmice <daniel@gultsch.de>2014-12-03 17:05:37 +0100
commite623e284874f5c53e8f6a588853a8cabaf206e20 (patch)
tree274ce9e82cbd3aee101318d6d2f4b9d1999788b3 /src/main/java/eu/siacs/conversations
parent46e319b241c3fe1f52eef44672ffbea9c6100227 (diff)
fixed #651
Diffstat (limited to 'src/main/java/eu/siacs/conversations')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Conversation.java12
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java8
2 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java
index ed42ac773..a7da0bc29 100644
--- a/src/main/java/eu/siacs/conversations/entities/Conversation.java
+++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java
@@ -458,6 +458,18 @@ public class Conversation extends AbstractEntity {
return false;
}
+ public Message findSentMessageWithBody(String body) {
+ synchronized (this.messages) {
+ for (int i = this.getMessages().size() - 1; i >= 0; --i) {
+ Message message = this.messages.get(i);
+ if ((message.getStatus() == Message.STATUS_UNSEND || message.getStatus() == Message.STATUS_SEND) && message.getBody() != null && message.getBody().equals(body)) {
+ return message;
+ }
+ }
+ return null;
+ }
+ }
+
public void setMutedTill(long value) {
this.setAttribute(ATTRIBUTE_MUTED_TILL, String.valueOf(value));
}
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index 8e559bd5f..782675dad 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -158,6 +158,14 @@ public class MessageParser extends AbstractParser implements
if (mXmppConnectionService.markMessage(conversation,
packet.getId(), Message.STATUS_SEND)) {
return null;
+ } else if (packet.getId() == null) {
+ Message message = conversation.findSentMessageWithBody(packet.getBody());
+ if (message != null) {
+ mXmppConnectionService.markMessage(message,Message.STATUS_SEND_RECEIVED);
+ return null;
+ } else {
+ status = Message.STATUS_SEND;
+ }
} else {
status = Message.STATUS_SEND;
}