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
|
@ -447,8 +447,14 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
|||
if (message.getQuote().isPresent()) {
|
||||
SignalServiceDataMessage.Quote quote = message.getQuote().get();
|
||||
System.out.println("Quote: (" + quote.getId() + ")");
|
||||
System.out.println(" Author: " + quote.getAuthor().getLegacyIdentifier());
|
||||
System.out.println(" Author: " + m.resolveSignalServiceAddress(quote.getAuthor()).getLegacyIdentifier());
|
||||
System.out.println(" Text: " + quote.getText());
|
||||
if (quote.getMentions().size() > 0) {
|
||||
System.out.println(" Mentions: ");
|
||||
for (SignalServiceDataMessage.Mention mention : quote.getMentions()) {
|
||||
printMention(mention, m);
|
||||
}
|
||||
}
|
||||
if (quote.getAttachments().size() > 0) {
|
||||
System.out.println(" Attachments: ");
|
||||
for (SignalServiceDataMessage.Quote.QuotedAttachment attachment : quote.getAttachments()) {
|
||||
|
@ -467,16 +473,9 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
|||
System.out.println("Remote delete message: timestamp = " + remoteDelete.getTargetSentTimestamp());
|
||||
}
|
||||
if (message.getMentions().isPresent()) {
|
||||
final List<SignalServiceDataMessage.Mention> mentions = message.getMentions().get();
|
||||
System.out.println("Mentions: ");
|
||||
for (SignalServiceDataMessage.Mention mention : mentions) {
|
||||
System.out.println("- "
|
||||
+ mention.getUuid()
|
||||
+ ": "
|
||||
+ mention.getStart()
|
||||
+ " (length: "
|
||||
+ mention.getLength()
|
||||
+ ")");
|
||||
for (SignalServiceDataMessage.Mention mention : message.getMentions().get()) {
|
||||
printMention(mention, m);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,6 +487,18 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private void printMention(SignalServiceDataMessage.Mention mention, Manager m) {
|
||||
System.out.println("- "
|
||||
+ m.resolveSignalServiceAddress(
|
||||
new SignalServiceAddress(mention.getUuid(), null)
|
||||
).getLegacyIdentifier()
|
||||
+ ": "
|
||||
+ mention.getStart()
|
||||
+ " (length: "
|
||||
+ mention.getLength()
|
||||
+ ")");
|
||||
}
|
||||
|
||||
private void printAttachment(SignalServiceAttachment attachment) {
|
||||
System.out.println("- " + attachment.getContentType() + " (" + (attachment.isPointer() ? "Pointer" : "") + (
|
||||
attachment.isStream() ? "Stream" : ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue