1 package org
.asamk
.signal
.json
;
3 import org
.asamk
.signal
.manager
.Manager
;
4 import org
.whispersystems
.signalservice
.api
.messages
.SignalServiceDataMessage
;
6 import java
.util
.ArrayList
;
9 public class JsonQuote
{
15 List
<JsonMention
> mentions
;
16 List
<JsonQuotedAttachment
> attachments
;
18 JsonQuote(SignalServiceDataMessage
.Quote quote
, Manager m
) {
19 this.id
= quote
.getId();
20 this.author
= m
.resolveSignalServiceAddress(quote
.getAuthor()).getLegacyIdentifier();
21 this.text
= quote
.getText();
23 if (quote
.getMentions().size() > 0) {
24 this.mentions
= new ArrayList
<>(quote
.getMentions().size());
26 for (SignalServiceDataMessage
.Mention quotedMention
: quote
.getMentions()){
27 this.mentions
.add(new JsonMention(quotedMention
, m
));
31 if (quote
.getAttachments().size() > 0) {
32 this.attachments
= new ArrayList
<>(quote
.getAttachments().size());
34 for (SignalServiceDataMessage
.Quote
.QuotedAttachment quotedAttachment
: quote
.getAttachments()) {
35 this.attachments
.add(new JsonQuotedAttachment(quotedAttachment
));
38 this.attachments
= new ArrayList
<>();