]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/ReceiveCommand.java
Add a new sync dbus message which shows messages you sent. Necessary for having synch...
[signal-cli] / src / main / java / org / asamk / signal / commands / ReceiveCommand.java
index ffc5953007cb5c3bc2f94de7af9cc7dc8fb94a58..42ab732704b92c81c015b0bade1bd40731d48ce4 100644 (file)
@@ -53,7 +53,22 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
                 });
                 dbusconnection.addSigHandler(Signal.ReceiptReceived.class,
                         receiptReceived -> System.out.print(String.format("Receipt from: %s\nTimestamp: %s\n",
-                                receiptReceived.getSender(), DateUtils.formatTimestamp(receiptReceived.getTimestamp()))));
+                            receiptReceived.getSender(), DateUtils.formatTimestamp(receiptReceived.getTimestamp()))));
+                dbusconnection.addSigHandler(Signal.SyncMessageReceived.class, syncReceived -> {
+                    System.out.print(String.format("Sync Envelope from: %s to: %s\nTimestamp: %s\nBody: %s\n",
+                            syncReceived.getSource(), syncReceived.getDestination(), DateUtils.formatTimestamp(syncReceived.getTimestamp()), syncReceived.getMessage()));
+                    if (syncReceived.getGroupId().length > 0) {
+                        System.out.println("Group info:");
+                        System.out.println("  Id: " + Base64.encodeBytes(syncReceived.getGroupId()));
+                    }
+                    if (syncReceived.getAttachments().size() > 0) {
+                        System.out.println("Attachments: ");
+                        for (String attachment : syncReceived.getAttachments()) {
+                            System.out.println("-  Stored plaintext in: " + attachment);
+                        }
+                    }
+                    System.out.println();
+                });
             } catch (UnsatisfiedLinkError e) {
                 System.err.println("Missing native library dependency for dbus service: " + e.getMessage());
                 return 1;