mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
44 lines
1.4 KiB
Java
44 lines
1.4 KiB
Java
package org.asamk.signal.json;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
import org.asamk.Signal;
|
|
import org.asamk.signal.manager.Manager;
|
|
import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage;
|
|
|
|
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);
|
|
|
|
if (transcriptMessage.getDestination().isPresent()) {
|
|
final var address = transcriptMessage.getDestination().get();
|
|
this.destination = getLegacyIdentifier(address);
|
|
this.destinationNumber = address.getNumber().orNull();
|
|
this.destinationUuid = address.getUuid().toString();
|
|
} else {
|
|
this.destination = null;
|
|
this.destinationNumber = null;
|
|
this.destinationUuid = null;
|
|
}
|
|
}
|
|
|
|
JsonSyncDataMessage(Signal.SyncMessageReceived messageReceived) {
|
|
super(messageReceived);
|
|
this.destination = messageReceived.getDestination();
|
|
this.destinationNumber = null;
|
|
this.destinationUuid = null;
|
|
}
|
|
}
|