change uuid when replacing messages
This commit is contained in:
parent
e6f8b7d9fa
commit
3bde4dbedb
|
@ -9,6 +9,7 @@ import net.java.otr4j.session.SessionStatus;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
|
import eu.siacs.conversations.crypto.axolotl.AxolotlService;
|
||||||
|
@ -400,6 +401,8 @@ public class MessageParser extends AbstractParser implements
|
||||||
&& replacedMessage.getTrueCounterpart().equals(message.getTrueCounterpart());
|
&& replacedMessage.getTrueCounterpart().equals(message.getTrueCounterpart());
|
||||||
if (fingerprintsMatch && (trueCountersMatch || conversation.getMode() == Conversation.MODE_SINGLE)) {
|
if (fingerprintsMatch && (trueCountersMatch || conversation.getMode() == Conversation.MODE_SINGLE)) {
|
||||||
Log.d(Config.LOGTAG, "replaced message '" + replacedMessage.getBody() + "' with '" + message.getBody() + "'");
|
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.setBody(message.getBody());
|
||||||
replacedMessage.setEdited(replacedMessage.getRemoteMsgId());
|
replacedMessage.setEdited(replacedMessage.getRemoteMsgId());
|
||||||
replacedMessage.setRemoteMsgId(remoteMsgId);
|
replacedMessage.setRemoteMsgId(remoteMsgId);
|
||||||
|
@ -407,7 +410,7 @@ public class MessageParser extends AbstractParser implements
|
||||||
if (replacedMessage.getStatus() == Message.STATUS_RECEIVED) {
|
if (replacedMessage.getStatus() == Message.STATUS_RECEIVED) {
|
||||||
replacedMessage.markUnread();
|
replacedMessage.markUnread();
|
||||||
}
|
}
|
||||||
mXmppConnectionService.updateMessage(replacedMessage);
|
mXmppConnectionService.updateMessage(replacedMessage, uuid);
|
||||||
if (mXmppConnectionService.confirmMessages() && remoteMsgId != null && !isForwarded && !isTypeGroupChat) {
|
if (mXmppConnectionService.confirmMessages() && remoteMsgId != null && !isForwarded && !isTypeGroupChat) {
|
||||||
sendMessageReceipts(account, packet);
|
sendMessageReceipts(account, packet);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2159,6 +2159,11 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
||||||
updateConversationUi();
|
updateConversationUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateMessage(Message message, String uuid) {
|
||||||
|
databaseBackend.updateMessage(message, uuid);
|
||||||
|
updateConversationUi();
|
||||||
|
}
|
||||||
|
|
||||||
protected void syncDirtyContacts(Account account) {
|
protected void syncDirtyContacts(Account account) {
|
||||||
for (Contact contact : account.getRoster().getContacts()) {
|
for (Contact contact : account.getRoster().getContacts()) {
|
||||||
if (contact.getOption(Contact.Options.DIRTY_PUSH)) {
|
if (contact.getOption(Contact.Options.DIRTY_PUSH)) {
|
||||||
|
|
Loading…
Reference in New Issue