From 0bbb4c9f29f95e1e961c594d45192c60cc1b1cd2 Mon Sep 17 00:00:00 2001 From: DieGurke <55625494+DieGurke@users.noreply.github.com> Date: Wed, 8 Jul 2020 13:53:10 +0200 Subject: [PATCH] Adjusted Query and implemented pending groupMessageStatusChange proc*ing --- src/main/java/envoy/server/data/GroupMessage.java | 3 ++- .../GroupMessageStatusChangeProcessor.java | 1 + .../processors/LoginCredentialProcessor.java | 14 +++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/envoy/server/data/GroupMessage.java b/src/main/java/envoy/server/data/GroupMessage.java index a9623a0..90ad823 100644 --- a/src/main/java/envoy/server/data/GroupMessage.java +++ b/src/main/java/envoy/server/data/GroupMessage.java @@ -21,7 +21,8 @@ import envoy.data.Group; name = GroupMessage.getPendingGroupMsg, query = "SELECT m FROM GroupMessage m JOIN m.memberMessageStatus s WHERE (KEY(s) = :userId) AND ((m.creationDate > :lastSeen)" + "OR ((m.status = envoy.data.Message$MessageStatus.RECEIVED) AND (m.receivedDate > :lastSeen))" - + "OR ((m.status = envoy.data.Message$MessageStatus.READ) AND (m.readDate > :lastSeen)))" + + "OR ((m.status = envoy.data.Message$MessageStatus.READ) AND (m.readDate > :lastSeen))" + + "OR ((m.lastStatusChangeDate > :lastSeen)))" ) public class GroupMessage extends Message { diff --git a/src/main/java/envoy/server/processors/GroupMessageStatusChangeProcessor.java b/src/main/java/envoy/server/processors/GroupMessageStatusChangeProcessor.java index 4720961..cc86e0c 100644 --- a/src/main/java/envoy/server/processors/GroupMessageStatusChangeProcessor.java +++ b/src/main/java/envoy/server/processors/GroupMessageStatusChangeProcessor.java @@ -42,6 +42,7 @@ public class GroupMessageStatusChangeProcessor implements ObjectProcessor + writeProxy.write(socketID, new GroupMessageStatusChange(gmsg.getID(), memberStatus, gmsg.getLastStatusChangeDate(), memberID))); + } + // Deliver just a status change instead of the whole message - writeProxy.write(socketID, new MessageStatusChange(gmsgCommon)); + if (gmsg.getStatus() == SENT && user.getLastSeen().isBefore(gmsg.getCreationDate()) + || gmsg.getStatus() == RECEIVED && user.getLastSeen().isBefore(gmsg.getReceivedDate())) + writeProxy.write(socketID, new MessageStatusChange(gmsgCommon)); } } }