]>
nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/signal/json/JsonQuote.java
10cd0bf4c31d3d7d50446364d6447086227a7bd8
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
;
8 import java
.util
.stream
.Collectors
;
10 public class JsonQuote
{
16 List
<JsonMention
> mentions
;
17 List
<JsonQuotedAttachment
> attachments
;
19 JsonQuote(SignalServiceDataMessage
.Quote quote
, Manager m
) {
20 this.id
= quote
.getId();
21 this.author
= m
.resolveSignalServiceAddress(quote
.getAuthor()).getLegacyIdentifier();
22 this.text
= quote
.getText();
24 if (quote
.getMentions() != null && quote
.getMentions().size() > 0) {
25 this.mentions
= quote
.getMentions()
27 .map(quotedMention
-> new JsonMention(quotedMention
, m
))
28 .collect(Collectors
.toList());
31 if (quote
.getAttachments().size() > 0) {
32 this.attachments
= quote
.getAttachments()
34 .map(JsonQuotedAttachment
::new)
35 .collect(Collectors
.toList());
37 this.attachments
= new ArrayList
<>();