]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/manager/Manager.java
Display more information for received messages
[signal-cli] / src / main / java / org / asamk / signal / manager / Manager.java
index 04bef98ea82160176e8bfa213e5d04ff5be6e874..54d3f92229fd794b34d853d640bbc2b1ae602328 100644 (file)
@@ -1049,6 +1049,19 @@ public class Manager implements Signal {
             }
             contact.profileKey = Base64.encodeBytes(message.getProfileKey().get());
         }
+        if (message.getPreviews().isPresent()) {
+            final List<SignalServiceDataMessage.Preview> previews = message.getPreviews().get();
+            for (SignalServiceDataMessage.Preview preview : previews) {
+                if (preview.getImage().isPresent() && preview.getImage().get().isPointer()) {
+                    SignalServiceAttachmentPointer attachment = preview.getImage().get().asPointer();
+                    try {
+                        retrieveAttachment(attachment);
+                    } catch (IOException | InvalidMessageException e) {
+                        System.err.println("Failed to retrieve attachment (" + attachment.getId() + "): " + e.getMessage());
+                    }
+                }
+            }
+        }
     }
 
     private void retryFailedReceivedMessages(ReceiveMessageHandler handler, boolean ignoreAttachments) {