- 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;
- if (quote.getMentions() != null && quote.getMentions().size() > 0) {
- mentions = quote.getMentions()
- .stream()
- .map(quotedMention -> JsonMention.from(quotedMention, m))
- .collect(Collectors.toList());
- } else {
- mentions = null;
- }
-
- final List<JsonQuotedAttachment> attachments;
- if (quote.getAttachments().size() > 0) {
- attachments = quote.getAttachments().stream().map(JsonQuotedAttachment::from).collect(Collectors.toList());
- } else {
- attachments = new ArrayList<>();
- }
-
- return new JsonQuote(id, author, authorNumber, authorUuid, text, mentions, attachments);
+ static JsonQuote from(MessageEnvelope.Data.Quote quote) {
+ final var id = quote.id();
+ final var address = quote.author();
+ final var author = address.getLegacyIdentifier();
+ final var authorNumber = address.number().orElse(null);
+ final var authorUuid = address.uuid().map(UUID::toString).orElse(null);
+ final var text = quote.text().orElse(null);
+
+ final var mentions = !quote.mentions().isEmpty()
+ ? quote.mentions().stream().map(JsonMention::from).toList()
+ : null;
+
+ final var attachments = !quote.attachments().isEmpty() ? quote.attachments()
+ .stream()
+ .map(JsonQuotedAttachment::from)
+ .toList() : List.<JsonQuotedAttachment>of();
+
+ final var textStyles = !quote.textStyles().isEmpty() ? quote.textStyles()
+ .stream()
+ .map(JsonTextStyle::from)
+ .toList() : null;
+
+ return new JsonQuote(id, author, authorNumber, authorUuid, text, mentions, attachments, textStyles);