aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-01-27 21:56:32 +0100
committerChristian Schneppe <christian@pix-art.de>2018-01-27 21:56:32 +0100
commitced57e3f3dd6b8d952f4b9d89ea6d10b16e1441a (patch)
tree09b70fe6294a847c3ea3c23a0664c34b353772fb
parentf4d40674fc76ad1cb6722110be12fc491a8d8ae7 (diff)
show self messages from other devices as received
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java
index d2b59077e..bbc9d05bb 100644
--- a/src/main/java/de/pixart/messenger/parser/MessageParser.java
+++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java
@@ -409,12 +409,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);
@@ -428,6 +435,15 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
if (serverMsgId == null) {
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;