diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-12-16 23:37:58 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-12-16 23:37:58 +0100 |
commit | 08bc3eb58c272d297e0016586ef144cb21153ff0 (patch) | |
tree | 49284de0f5985829379cce9adcdcc757fe54c9e6 /src/main/java/de/pixart | |
parent | a5bfc704a3f16de4d0c30d5d47cc142bc2924cf0 (diff) |
ChatMarkers: parse own account from true counterpart
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/parser/MessageParser.java | 9 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 3 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java index dd97291a1..dead57709 100644 --- a/src/main/java/de/pixart/messenger/parser/MessageParser.java +++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java @@ -732,13 +732,14 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece if (conversation != null && id != null && sender != null) { Message message = conversation.findMessageWithRemoteId(id, sender); if (message != null) { - if (conversation.getMucOptions().isSelf(counterpart)) { + final Jid fallback = conversation.getMucOptions().getTrueCounterpart(counterpart); + final Jid trueJid = getTrueCounterpart((query != null && query.safeToExtractTrueCounterpart()) ? mucUserElement : null, fallback); + final boolean trueJidMatchesAccount = account.getJid().toBareJid().equals(trueJid == null ? null : trueJid.toBareJid()); + if (trueJidMatchesAccount || conversation.getMucOptions().isSelf(counterpart)) { if (!message.isRead() && (query == null || query.isCatchup())) { //checking if message is unread fixes race conditions with reflections mXmppConnectionService.markRead(conversation); } - } else { - final Jid fallback = conversation.getMucOptions().getTrueCounterpart(counterpart); - Jid trueJid = getTrueCounterpart((query != null && query.safeToExtractTrueCounterpart()) ? mucUserElement : null, fallback); + } else if (!counterpart.isBareJid() && trueJid != null){ ReadByMarker readByMarker = ReadByMarker.from(counterpart, trueJid); if (message.addReadByMarker(readByMarker)) { Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": added read by (" + readByMarker.getRealJid() + ") to message '" + message.getBody() + "'"); diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index c37c5cee7..90a3057ba 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -1418,9 +1418,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa state = ChatState.PAUSED; users = conversation.getMucOptions().getUsersWithChatState(state, 5); } - int markersAdded = 0; if (mucOptions.membersOnly() && mucOptions.nonanonymous()) { - //addedMarkers.addAll(ReadByMarker.from(users)); for (int i = this.messageList.size() - 1; i >= 0; --i) { final Set<ReadByMarker> markersForMessage = messageList.get(i).getReadByMarkers(); final List<MucOptions.User> shownMarkers = new ArrayList<>(); @@ -1453,7 +1451,6 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa statusMessage = null; } if (statusMessage != null) { - ++markersAdded; this.messageList.add(i + 1, statusMessage); } addedMarkers.add(markerForSender); |