]>
nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/json/JsonQuote.java
f90b492d135b23334adbe00b7de6cacb26860005
1 package org
.asamk
.signal
.json
;
3 import com
.fasterxml
.jackson
.annotation
.JsonInclude
;
4 import com
.fasterxml
.jackson
.annotation
.JsonProperty
;
6 import org
.asamk
.signal
.manager
.Manager
;
7 import org
.whispersystems
.signalservice
.api
.messages
.SignalServiceDataMessage
;
9 import java
.util
.ArrayList
;
10 import java
.util
.List
;
11 import java
.util
.stream
.Collectors
;
13 import static org
.asamk
.signal
.util
.Util
.getLegacyIdentifier
;
15 public class JsonQuote
{
27 @JsonInclude(JsonInclude
.Include
.NON_NULL
)
28 final List
<JsonMention
> mentions
;
31 final List
<JsonQuotedAttachment
> attachments
;
33 JsonQuote(SignalServiceDataMessage
.Quote quote
, Manager m
) {
34 this.id
= quote
.getId();
35 this.author
= getLegacyIdentifier(m
.resolveSignalServiceAddress(quote
.getAuthor()));
36 this.text
= quote
.getText();
38 if (quote
.getMentions() != null && quote
.getMentions().size() > 0) {
39 this.mentions
= quote
.getMentions()
41 .map(quotedMention
-> new JsonMention(quotedMention
, m
))
42 .collect(Collectors
.toList());
47 if (quote
.getAttachments().size() > 0) {
48 this.attachments
= quote
.getAttachments()
50 .map(JsonQuotedAttachment
::new)
51 .collect(Collectors
.toList());
53 this.attachments
= new ArrayList
<>();