From a5256c3e83ca4fc124c214dbab27e20a3f6458ed Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 27 Jan 2018 09:15:02 +0100 Subject: [PATCH] show self messages from other devices as received --- .../conversations/parser/MessageParser.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index 6cd025460..da82e9983 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -410,12 +410,19 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece } boolean isProperlyAddressed = (to != null) && (!to.isBareJid() || account.countPresences() == 0); boolean isMucStatusMessage = from.isBareJid() && mucUserElement != null && mucUserElement.hasChild("status"); + boolean selfAddressed; if (packet.fromAccount(account)) { status = Message.STATUS_SEND; - counterpart = to != null ? to : account.getJid(); + selfAddressed = to == null || account.getJid().toBareJid().equals(to.toBareJid()); + if (selfAddressed) { + counterpart = from; + } else { + counterpart = to != null ? to : account.getJid(); + } } else { status = Message.STATUS_RECEIVED; counterpart = from; + selfAddressed = false; } Invite invite = extractInvite(account, packet); @@ -431,6 +438,17 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece serverMsgId = extractStanzaId(packet, isTypeGroupChat, conversation); } + + if (selfAddressed) { + if (mXmppConnectionService.markMessage(conversation, remoteMsgId, Message.STATUS_SEND_RECEIVED, serverMsgId)) { + return; + } + status = Message.STATUS_RECEIVED; + if (conversation.findMessageWithRemoteId(remoteMsgId,counterpart) != null) { + return; + } + } + if (isTypeGroupChat) { if (conversation.getMucOptions().isSelf(counterpart)) { status = Message.STATUS_SEND_RECEIVED;