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)); } } }