-public class JsonQuote {
-
- @JsonProperty
- final long id;
-
- @JsonProperty
- final String author;
-
- @JsonProperty
- final String text;
-
- @JsonProperty
- @JsonInclude(JsonInclude.Include.NON_NULL)
- final List<JsonMention> mentions;
-
- @JsonProperty
- final List<JsonQuotedAttachment> attachments;
-
- JsonQuote(SignalServiceDataMessage.Quote quote, Manager m) {
- this.id = quote.getId();
- this.author = m.resolveSignalServiceAddress(quote.getAuthor()).getLegacyIdentifier();
- this.text = quote.getText();
-
+import static org.asamk.signal.util.Util.getLegacyIdentifier;
+
+public record JsonQuote(
+ long id,
+ @Deprecated String author,
+ String authorNumber,
+ String authorUuid,
+ String text,
+ @JsonInclude(JsonInclude.Include.NON_NULL) List<JsonMention> mentions,
+ List<JsonQuotedAttachment> attachments
+) {
+
+ static JsonQuote from(SignalServiceDataMessage.Quote quote, Manager m) {
+ final var id = quote.getId();
+ final var address = m.resolveSignalServiceAddress(quote.getAuthor());
+ final var author = getLegacyIdentifier(address);
+ final var authorNumber = address.getNumber().orNull();
+ final var authorUuid = address.getUuid().toString();
+ final var text = quote.getText();
+
+ final List<JsonMention> mentions;