aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/entities')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Conversation.java5
-rw-r--r--src/main/java/de/pixart/messenger/entities/Message.java17
2 files changed, 20 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java
index a43899663..866b33597 100644
--- a/src/main/java/de/pixart/messenger/entities/Conversation.java
+++ b/src/main/java/de/pixart/messenger/entities/Conversation.java
@@ -365,11 +365,12 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
public Message findMessageWithRemoteIdAndCounterpart(String id, Jid counterpart, boolean received, boolean carbon) {
synchronized (this.messages) {
for (int i = this.messages.size() - 1; i >= 0; --i) {
- Message message = messages.get(i);
+ final Message message = messages.get(i);
if (counterpart.equals(message.getCounterpart())
&& ((message.getStatus() == Message.STATUS_RECEIVED) == received)
&& (carbon == message.isCarbon() || received)) {
- if (id.equals(message.getRemoteMsgId()) && !message.isFileOrImage() && !message.treatAsDownloadable()) {
+ final boolean idMatch = id.equals(message.getRemoteMsgId()) || message.remoteMsgIdMatchInEdit(id);
+ if (idMatch && !message.isFileOrImage() && !message.treatAsDownloadable()) {
return message;
} else {
return null;
diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java
index 59047550b..c0e6fb8cb 100644
--- a/src/main/java/de/pixart/messenger/entities/Message.java
+++ b/src/main/java/de/pixart/messenger/entities/Message.java
@@ -451,6 +451,15 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable
this.edits.add(new Edited(edited, serverMsgId));
}
+ public boolean remoteMsgIdMatchInEdit(String id) {
+ for (Edited edit : this.edits) {
+ if (id.equals(edit.getEditedId())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public String getBodyLanguage() {
return this.bodyLanguage;
}
@@ -751,6 +760,14 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable
}
}
+ public String getEditedIdWireFormat() {
+ if (edits.size() > 0) {
+ return edits.get(Config.USE_LMC_VERSION_1_1 ? 0 : edits.size() - 1).getEditedId();
+ } else {
+ throw new IllegalStateException("Attempting to store unedited message");
+ }
+ }
+
public void setOob(boolean isOob) {
this.oob = isOob;
}