mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-03 12:50:37 +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
|
@ -6,13 +6,22 @@ import org.asamk.signal.manager.Manager;
|
|||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.asamk.signal.util.Util.getLegacyIdentifier;
|
||||
|
||||
public class JsonMention {
|
||||
|
||||
@JsonProperty
|
||||
@Deprecated
|
||||
final String name;
|
||||
|
||||
@JsonProperty
|
||||
final String number;
|
||||
|
||||
@JsonProperty
|
||||
final String uuid;
|
||||
|
||||
@JsonProperty
|
||||
final int start;
|
||||
|
||||
|
@ -20,8 +29,10 @@ public class JsonMention {
|
|||
final int length;
|
||||
|
||||
JsonMention(SignalServiceDataMessage.Mention mention, Manager m) {
|
||||
this.name = getLegacyIdentifier(m.resolveSignalServiceAddress(new SignalServiceAddress(mention.getUuid(),
|
||||
null)));
|
||||
final var address = m.resolveSignalServiceAddress(new SignalServiceAddress(mention.getUuid(), null));
|
||||
this.name = getLegacyIdentifier(address);
|
||||
this.number = address.getNumber().orNull();
|
||||
this.uuid = address.getUuid().transform(UUID::toString).orNull();
|
||||
this.start = mention.getStart();
|
||||
this.length = mention.getLength();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue