diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/ServerManager.java')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/ServerManager.java | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/juick-server/src/main/java/com/juick/server/ServerManager.java b/juick-server/src/main/java/com/juick/server/ServerManager.java index a50571e6..8a9d224b 100644 --- a/juick-server/src/main/java/com/juick/server/ServerManager.java +++ b/juick-server/src/main/java/com/juick/server/ServerManager.java @@ -187,22 +187,24 @@ public class ServerManager implements NotificationListener { @Override public void processMessageReadEvent(MessageReadEvent messageReadEvent) { - User userTo = messageReadEvent.getUser(); + List<User> users = messageReadEvent.getUsers(); Message source = messageReadEvent.getMessage(); - logger.info("Message read event from {} for {}", userTo.getName(), source.getMid()); - wsHandler.getClients().stream().filter(c -> - (!c.legacy && c.visitor.getUid() == userTo.getUid()) || c.visitor.getName().equals(serviceUser) - ).forEach(u -> { - Message serviceMessage = new Message(); - serviceMessage.setService(true); - serviceMessage.setUser(userTo); - serviceMessage.setMid(source.getMid()); - serviceMessage.setUnread(false); - try { - u.sendMessage(new TextMessage(jsonMapper.writeValueAsString(serviceMessage))); - } catch (IOException e) { - logger.error("JSON error", e); - } + users.forEach(userTo -> { + logger.info("Message read event from {} for {}", userTo.getName(), source.getMid()); + wsHandler.getClients().stream().filter(c -> + (!c.legacy && c.visitor.getUid() == userTo.getUid()) || c.visitor.getName().equals(serviceUser) + ).forEach(u -> { + Message serviceMessage = new Message(); + serviceMessage.setService(true); + serviceMessage.setUser(userTo); + serviceMessage.setMid(source.getMid()); + serviceMessage.setUnread(false); + try { + u.sendMessage(new TextMessage(jsonMapper.writeValueAsString(serviceMessage))); + } catch (IOException e) { + logger.error("JSON error", e); + } + }); }); } } |