From ea6d76757ef24670ee14ee96cd08f0671e1befc8 Mon Sep 17 00:00:00 2001 From: CyB3RC0nN0R Date: Sun, 16 Feb 2020 10:31:17 +0100 Subject: [PATCH] Copying received and read dates in Message#toCommonMessage() --- src/main/java/envoy/server/data/Message.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/envoy/server/data/Message.java b/src/main/java/envoy/server/data/Message.java index afe907d..2655cbf 100644 --- a/src/main/java/envoy/server/data/Message.java +++ b/src/main/java/envoy/server/data/Message.java @@ -79,13 +79,21 @@ public class Message { } /** - * @return a database {@link Message} converted into an - * {@link envoy.data.Message} + * Converts this message into an instance of {@link envoy.data.Message}. + * + * @return a {@link envoy.data.Message} containing the same values as this + * message * @since Envoy Server Standalone v0.1-alpha */ public envoy.data.Message toCommonMessage() { - // TODO: Attachment, dates - return new MessageBuilder(sender.getId(), recipient.getId(), id).setText(text).setDate(creationDate).setStatus(status).build(); + // TODO: Attachment + envoy.data.Message message = new MessageBuilder(sender.getId(), recipient.getId(), id).setText(text) + .setDate(creationDate) + .setStatus(status) + .build(); + message.setReceivedDate(receivedDate); + message.setReadDate(readDate); + return message; } /**