aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-11-21 10:00:25 +0300
committerGravatar Vitaly Takmazov2018-11-21 10:00:25 +0300
commit366a0192fee0d2bd8fc13bed47e3a3e61ebb5f90 (patch)
tree3eabf1199934c5a8f98f233c7f86ee4cc212815e /src/main
parent48b3585786f463592b67f825394ac62cdeaab787 (diff)
Mark all messages read when receiving command from XMPP and Telegram
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/juick/server/TelegramBotManager.java1
-rw-r--r--src/main/java/com/juick/server/XMPPConnection.java1
2 files changed, 2 insertions, 0 deletions
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<Long> 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);
}