aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/ServerManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-09-25 13:02:14 +0300
committerGravatar Vitaly Takmazov2018-09-25 13:02:14 +0300
commit68789ca6c3972db476a325cd5c1bdc70cd7962f6 (patch)
tree7429a98fdcc05eaf76b3e8cf625ba3f21288d79d /juick-server/src/main/java/com/juick/server/ServerManager.java
parent15753b2ebdac2ab49cf5682c417851a0653e136e (diff)
update juick-server to new events api
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.java32
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);
+ }
+ });
});
}
}