aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart')
-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())) {