aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-08-03 23:56:13 +0200
committerChristian Schneppe <christian@pix-art.de>2018-08-03 23:56:13 +0200
commit16f2aad5973163e7d473153af282f5fa5783ec36 (patch)
treed22af5dc232a51db5911813050178ec972df3ab6 /src/main
parent2ba8db31de2f3c2af0334c035b8275aee2ff2920 (diff)
also mark previews unread messages as read
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java12
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java4
2 files changed, 14 insertions, 2 deletions
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);
+ }
}
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 58f9441fa..f1ebb0d63 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -2540,7 +2540,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (!ReadByMarker.contains(marker, addedMarkers)) {
addedMarkers.add(marker); //may be put outside this condition. set should do dedup anyway
MucOptions.User user = mucOptions.findUser(marker);
- shownMarkers.add(user);
+ if (user != null && !users.contains(user)) {
+ shownMarkers.add(user);
+ }
}
}
final ReadByMarker markerForSender = ReadByMarker.from(messageList.get(i));