mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Quotes, Mentions and Reactions in non-daemon JSON mode (#389)
* Added support for quotes, mentions and reactions in non-daemon JSON output
This commit is contained in:
parent
548c313b4c
commit
58db3cbd53
10 changed files with 162 additions and 19 deletions
42
src/main/java/org/asamk/signal/json/JsonQuote.java
Normal file
42
src/main/java/org/asamk/signal/json/JsonQuote.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package org.asamk.signal.json;
|
||||
|
||||
import org.asamk.signal.manager.Manager;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class JsonQuote {
|
||||
|
||||
long id;
|
||||
String author;
|
||||
String text;
|
||||
|
||||
List<JsonMention> mentions;
|
||||
List<JsonQuotedAttachment> attachments;
|
||||
|
||||
JsonQuote(SignalServiceDataMessage.Quote quote, Manager m) {
|
||||
this.id = quote.getId();
|
||||
this.author = m.resolveSignalServiceAddress(quote.getAuthor()).getLegacyIdentifier();
|
||||
this.text = quote.getText();
|
||||
|
||||
if (quote.getMentions().size() > 0) {
|
||||
this.mentions = new ArrayList<>(quote.getMentions().size());
|
||||
|
||||
for (SignalServiceDataMessage.Mention quotedMention: quote.getMentions()){
|
||||
this.mentions.add(new JsonMention(quotedMention, m));
|
||||
}
|
||||
}
|
||||
|
||||
if (quote.getAttachments().size() > 0) {
|
||||
this.attachments = new ArrayList<>(quote.getAttachments().size());
|
||||
|
||||
for (SignalServiceDataMessage.Quote.QuotedAttachment quotedAttachment : quote.getAttachments()) {
|
||||
this.attachments.add(new JsonQuotedAttachment(quotedAttachment));
|
||||
}
|
||||
} else {
|
||||
this.attachments = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue