aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-12-14 22:27:59 +0100
committerChristian Schneppe <christian@pix-art.de>2018-12-14 22:27:59 +0100
commit05f847766f04789d058cf3fa407fbdb231adc4f2 (patch)
tree64084b58eda50c24d5f37b4788182d45d5f2da5a /src/main/java/de/pixart/messenger
parentf0376cc748f162fb0148ef003212b9033a9acbc1 (diff)
bring back previews unread messages as read in groups
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java
index 7667a6ffc..4df9f955d 100644
--- a/src/main/java/de/pixart/messenger/parser/MessageParser.java
+++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java
@@ -886,6 +886,7 @@ 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);
+ updateReadMarker(account, from, id, selfAddressed, counterpart, query);
}
}
}
@@ -924,6 +925,20 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
}
}
+ private void updateReadMarker(Account account, Jid from, String id, boolean selfAddressed, Jid counterpart, MessageArchiveService.Query query) {
+ 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);
+ }
+ }
+
private void dismissNotification(Account account, Jid counterpart, MessageArchiveService.Query query) {
Conversation conversation = mXmppConnectionService.find(account, counterpart.asBareJid());
if (conversation != null && (query == null || query.isCatchup())) {