From 16f2aad5973163e7d473153af282f5fa5783ec36 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Fri, 3 Aug 2018 23:56:13 +0200 Subject: also mark previews unread messages as read --- src/main/java/de/pixart/messenger/parser/MessageParser.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main/java/de/pixart/messenger/parser') diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java index e86758fd7..7cfd69e8b 100644 --- a/src/main/java/de/pixart/messenger/parser/MessageParser.java +++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java @@ -844,7 +844,17 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece if (message.addReadByMarker(readByMarker)) { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": added read by (" + readByMarker.getRealJid() + ") to message '" + message.getBody() + "'"); mXmppConnectionService.updateMessage(message, false); - mXmppConnectionService.markMessage(account, from.asBareJid(), id, Message.STATUS_SEND_DISPLAYED); + final Message displayedMessage = mXmppConnectionService.markMessage(account, from.asBareJid(), id, Message.STATUS_SEND_DISPLAYED); + Message m = displayedMessage == null ? null : displayedMessage.prev(); + while (m != null + && m.getStatus() == Message.STATUS_SEND_RECEIVED + && m.getTimeSent() < displayedMessage.getTimeSent()) { + mXmppConnectionService.markMessage(m, Message.STATUS_SEND_DISPLAYED); + m = m.prev(); + } + if (displayedMessage != null && selfAddressed) { + dismissNotification(account, counterpart, query); + } } } } -- cgit v1.2.3