Add remote delete info to json output

Fixes #424
This commit is contained in:
AsamK 2021-01-17 11:57:46 +01:00
parent 3b29add396
commit a28ad7195c
2 changed files with 23 additions and 0 deletions

View file

@ -48,6 +48,10 @@ class JsonDataMessage {
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
final JsonSticker sticker; final JsonSticker sticker;
@JsonProperty
@JsonInclude(JsonInclude.Include.NON_NULL)
final JsonRemoteDelete remoteDelete;
@JsonProperty @JsonProperty
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
final JsonGroupInfo groupInfo; final JsonGroupInfo groupInfo;
@ -84,6 +88,8 @@ class JsonDataMessage {
} else { } else {
this.mentions = List.of(); this.mentions = List.of();
} }
remoteDelete = dataMessage.getRemoteDelete().isPresent() ? new JsonRemoteDelete(dataMessage.getRemoteDelete()
.get()) : null;
if (dataMessage.getAttachments().isPresent()) { if (dataMessage.getAttachments().isPresent()) {
this.attachments = dataMessage.getAttachments() this.attachments = dataMessage.getAttachments()
.get() .get()
@ -102,6 +108,7 @@ class JsonDataMessage {
groupInfo = messageReceived.getGroupId().length > 0 ? new JsonGroupInfo(messageReceived.getGroupId()) : null; groupInfo = messageReceived.getGroupId().length > 0 ? new JsonGroupInfo(messageReceived.getGroupId()) : null;
expiresInSeconds = null; expiresInSeconds = null;
viewOnce = null; viewOnce = null;
remoteDelete = null;
reaction = null; // TODO Replace these 4 with the proper commands reaction = null; // TODO Replace these 4 with the proper commands
quote = null; quote = null;
mentions = null; mentions = null;
@ -115,6 +122,7 @@ class JsonDataMessage {
groupInfo = messageReceived.getGroupId().length > 0 ? new JsonGroupInfo(messageReceived.getGroupId()) : null; groupInfo = messageReceived.getGroupId().length > 0 ? new JsonGroupInfo(messageReceived.getGroupId()) : null;
expiresInSeconds = null; expiresInSeconds = null;
viewOnce = null; viewOnce = null;
remoteDelete = null;
reaction = null; // TODO Replace these 4 with the proper commands reaction = null; // TODO Replace these 4 with the proper commands
quote = null; quote = null;
mentions = null; mentions = null;

View file

@ -0,0 +1,15 @@
package org.asamk.signal.json;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
class JsonRemoteDelete {
@JsonProperty
final long timestamp;
JsonRemoteDelete(SignalServiceDataMessage.RemoteDelete remoteDelete) {
this.timestamp = remoteDelete.getTargetSentTimestamp();
}
}