From 366a0192fee0d2bd8fc13bed47e3a3e61ebb5f90 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 21 Nov 2018 10:00:25 +0300 Subject: Mark all messages read when receiving command from XMPP and Telegram --- src/main/java/com/juick/server/TelegramBotManager.java | 1 + src/main/java/com/juick/server/XMPPConnection.java | 1 + 2 files changed, 2 insertions(+) (limited to 'src/main/java/com/juick') diff --git a/src/main/java/com/juick/server/TelegramBotManager.java b/src/main/java/com/juick/server/TelegramBotManager.java index 82114fb5..bf2f5a84 100644 --- a/src/main/java/com/juick/server/TelegramBotManager.java +++ b/src/main/java/com/juick/server/TelegramBotManager.java @@ -227,6 +227,7 @@ public class TelegramBotManager implements NotificationListener { } } } + messagesService.getUnread(user_from).forEach(mid -> messagesService.setRead(user_from, mid)); } else { List chats = telegramService.getAnonymous(); if (!chats.contains(message.chat().id())) { diff --git a/src/main/java/com/juick/server/XMPPConnection.java b/src/main/java/com/juick/server/XMPPConnection.java index 44cc4a30..e0e45cf7 100644 --- a/src/main/java/com/juick/server/XMPPConnection.java +++ b/src/main/java/com/juick/server/XMPPConnection.java @@ -620,6 +620,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { result = incomingMessageJuick(user_from, msg.getFrom(), String.format("@%s %s", msg.getTo().getLocal(), StringUtils.defaultString(msg.getBody())), attachment); } + messagesService.getUnread(user_from).forEach(mid -> messagesService.setRead(user_from, mid)); } catch (Exception e1) { logger.warn("message exception", e1); } -- cgit v1.2.3