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:
Atomic-Bean 2020-12-23 20:53:40 +10:30 committed by GitHub
parent 548c313b4c
commit 58db3cbd53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 162 additions and 19 deletions

View file

@ -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" : ""