mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-01 20:10:39 +00:00
Extend json output with number and uuid fields
This commit is contained in:
parent
73e137137d
commit
5bbfd32598
9 changed files with 148 additions and 32 deletions
|
@ -4,22 +4,43 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
|
||||
import org.asamk.Signal;
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.asamk.signal.util.Util;
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.asamk.signal.util.Util.getLegacyIdentifier;
|
||||
|
||||
class JsonSyncDataMessage extends JsonDataMessage {
|
||||
|
||||
@JsonProperty
|
||||
@Deprecated
|
||||
final String destination;
|
||||
|
||||
@JsonProperty
|
||||
final String destinationNumber;
|
||||
|
||||
@JsonProperty
|
||||
final String destinationUuid;
|
||||
|
||||
JsonSyncDataMessage(SentTranscriptMessage transcriptMessage, Manager m) {
|
||||
super(transcriptMessage.getMessage(), m);
|
||||
|
||||
this.destination = transcriptMessage.getDestination().transform(Util::getLegacyIdentifier).orNull();
|
||||
if (transcriptMessage.getDestination().isPresent()) {
|
||||
final var address = transcriptMessage.getDestination().get();
|
||||
this.destination = getLegacyIdentifier(address);
|
||||
this.destinationNumber = address.getNumber().orNull();
|
||||
this.destinationUuid = address.getUuid().transform(UUID::toString).orNull();
|
||||
} else {
|
||||
this.destination = null;
|
||||
this.destinationNumber = null;
|
||||
this.destinationUuid = null;
|
||||
}
|
||||
}
|
||||
|
||||
JsonSyncDataMessage(Signal.SyncMessageReceived messageReceived) {
|
||||
super(messageReceived);
|
||||
destination = messageReceived.getDestination();
|
||||
this.destination = messageReceived.getDestination();
|
||||
this.destinationNumber = null;
|
||||
this.destinationUuid = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue