mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40: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
|
@ -5,6 +5,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
import org.asamk.signal.manager.Manager;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage.Reaction;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.asamk.signal.util.Util.getLegacyIdentifier;
|
||||
|
||||
public class JsonReaction {
|
||||
|
@ -13,8 +15,15 @@ public class JsonReaction {
|
|||
final String emoji;
|
||||
|
||||
@JsonProperty
|
||||
@Deprecated
|
||||
final String targetAuthor;
|
||||
|
||||
@JsonProperty
|
||||
final String targetAuthorNumber;
|
||||
|
||||
@JsonProperty
|
||||
final String targetAuthorUuid;
|
||||
|
||||
@JsonProperty
|
||||
final long targetSentTimestamp;
|
||||
|
||||
|
@ -23,7 +32,10 @@ public class JsonReaction {
|
|||
|
||||
JsonReaction(Reaction reaction, Manager m) {
|
||||
this.emoji = reaction.getEmoji();
|
||||
this.targetAuthor = getLegacyIdentifier(m.resolveSignalServiceAddress(reaction.getTargetAuthor()));
|
||||
final var address = m.resolveSignalServiceAddress(reaction.getTargetAuthor());
|
||||
this.targetAuthor = getLegacyIdentifier(address);
|
||||
this.targetAuthorNumber = address.getNumber().orNull();
|
||||
this.targetAuthorUuid = address.getUuid().transform(UUID::toString).orNull();
|
||||
this.targetSentTimestamp = reaction.getTargetSentTimestamp();
|
||||
this.isRemove = reaction.isRemove();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue