aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-02-20 00:01:39 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-02-20 00:01:39 +0100
commit3bde4dbedb80a8e1de89c09f58d842d7382598e8 (patch)
tree4f0eb40378d7a4a6a2a992327f184dfaddf78ad5 /src/main/java/eu
parente6f8b7d9fa30e4e231a07cdbbb225e462893eb3d (diff)
change uuid when replacing messages
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java5
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java5
2 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index 247fd72b..f01e7ce1 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -9,6 +9,7 @@ import net.java.otr4j.session.SessionStatus;
import java.util.ArrayList;
import java.util.Set;
+import java.util.UUID;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
@@ -400,6 +401,8 @@ public class MessageParser extends AbstractParser implements
&& replacedMessage.getTrueCounterpart().equals(message.getTrueCounterpart());
if (fingerprintsMatch && (trueCountersMatch || conversation.getMode() == Conversation.MODE_SINGLE)) {
Log.d(Config.LOGTAG, "replaced message '" + replacedMessage.getBody() + "' with '" + message.getBody() + "'");
+ final String uuid = replacedMessage.getUuid();
+ replacedMessage.setUuid(UUID.randomUUID().toString());
replacedMessage.setBody(message.getBody());
replacedMessage.setEdited(replacedMessage.getRemoteMsgId());
replacedMessage.setRemoteMsgId(remoteMsgId);
@@ -407,7 +410,7 @@ public class MessageParser extends AbstractParser implements
if (replacedMessage.getStatus() == Message.STATUS_RECEIVED) {
replacedMessage.markUnread();
}
- mXmppConnectionService.updateMessage(replacedMessage);
+ mXmppConnectionService.updateMessage(replacedMessage, uuid);
if (mXmppConnectionService.confirmMessages() && remoteMsgId != null && !isForwarded && !isTypeGroupChat) {
sendMessageReceipts(account, packet);
}
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 9b730637..b836e780 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -2159,6 +2159,11 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
updateConversationUi();
}
+ public void updateMessage(Message message, String uuid) {
+ databaseBackend.updateMessage(message, uuid);
+ updateConversationUi();
+ }
+
protected void syncDirtyContacts(Account account) {
for (Contact contact : account.getRoster().getContacts()) {
if (contact.getOption(Contact.Options.DIRTY_PUSH)) {