X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/5a2c4b8dfdbda71d6932998c48c9ffa633bb227c..6c33a89f82ffac98454c6f854e1c8877e3941f6a:/src/main/java/org/asamk/signal/json/JsonDataMessage.java diff --git a/src/main/java/org/asamk/signal/json/JsonDataMessage.java b/src/main/java/org/asamk/signal/json/JsonDataMessage.java index 4636d808..57facc99 100644 --- a/src/main/java/org/asamk/signal/json/JsonDataMessage.java +++ b/src/main/java/org/asamk/signal/json/JsonDataMessage.java @@ -48,6 +48,14 @@ class JsonDataMessage { @JsonInclude(JsonInclude.Include.NON_NULL) final JsonSticker sticker; + @JsonProperty + @JsonInclude(JsonInclude.Include.NON_NULL) + final JsonRemoteDelete remoteDelete; + + @JsonProperty + @JsonInclude(JsonInclude.Include.NON_NULL) + final List contacts; + @JsonProperty @JsonInclude(JsonInclude.Include.NON_NULL) final JsonGroupInfo groupInfo; @@ -84,6 +92,8 @@ class JsonDataMessage { } else { this.mentions = List.of(); } + remoteDelete = dataMessage.getRemoteDelete().isPresent() ? new JsonRemoteDelete(dataMessage.getRemoteDelete() + .get()) : null; if (dataMessage.getAttachments().isPresent()) { this.attachments = dataMessage.getAttachments() .get() @@ -94,6 +104,16 @@ class JsonDataMessage { this.attachments = List.of(); } this.sticker = dataMessage.getSticker().isPresent() ? new JsonSticker(dataMessage.getSticker().get()) : null; + + if (dataMessage.getSharedContacts().isPresent()) { + this.contacts = dataMessage.getSharedContacts() + .get() + .stream() + .map(JsonSharedContact::new) + .collect(Collectors.toList()); + } else { + this.contacts = List.of(); + } } public JsonDataMessage(Signal.MessageReceived messageReceived) { @@ -102,10 +122,12 @@ class JsonDataMessage { groupInfo = messageReceived.getGroupId().length > 0 ? new JsonGroupInfo(messageReceived.getGroupId()) : null; expiresInSeconds = null; viewOnce = null; - reaction = null; // TODO Replace these 4 with the proper commands + remoteDelete = null; + reaction = null; // TODO Replace these 5 with the proper commands quote = null; mentions = null; sticker = null; + contacts = null; attachments = messageReceived.getAttachments().stream().map(JsonAttachment::new).collect(Collectors.toList()); } @@ -115,10 +137,12 @@ class JsonDataMessage { groupInfo = messageReceived.getGroupId().length > 0 ? new JsonGroupInfo(messageReceived.getGroupId()) : null; expiresInSeconds = null; viewOnce = null; - reaction = null; // TODO Replace these 4 with the proper commands + remoteDelete = null; + reaction = null; // TODO Replace these 5 with the proper commands quote = null; mentions = null; sticker = null; + contacts = null; attachments = messageReceived.getAttachments().stream().map(JsonAttachment::new).collect(Collectors.toList()); } }