mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Output "SharedContacts" field from a SignalDataMessage (#529)
* Initial version of SharedContacts from data message. Need to change location of avatar downloaded and fix plain text mode * Made empty strings for json null and fixed plaintext output * Removed old comments, simplified if-statement and added a 'leadingSpaces' field to the print attachments/mentions functions * Added AsamK's changes
This commit is contained in:
parent
9f3276d7e3
commit
237abe431b
10 changed files with 399 additions and 25 deletions
|
@ -52,6 +52,10 @@ class JsonDataMessage {
|
|||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
final JsonRemoteDelete remoteDelete;
|
||||
|
||||
@JsonProperty
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
final List<JsonSharedContact> contacts;
|
||||
|
||||
@JsonProperty
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
final JsonGroupInfo groupInfo;
|
||||
|
@ -100,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) {
|
||||
|
@ -109,10 +123,11 @@ class JsonDataMessage {
|
|||
expiresInSeconds = null;
|
||||
viewOnce = null;
|
||||
remoteDelete = null;
|
||||
reaction = null; // TODO Replace these 4 with the proper commands
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -123,10 +138,11 @@ class JsonDataMessage {
|
|||
expiresInSeconds = null;
|
||||
viewOnce = null;
|
||||
remoteDelete = null;
|
||||
reaction = null; // TODO Replace these 4 with the proper commands
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue