From 58895aaf03742cb5c2067ec54ab3ab2bfaaa27b4 Mon Sep 17 00:00:00 2001 From: Parker Higgins Date: Wed, 9 Jan 2019 14:17:45 -0500 Subject: [PATCH] Expose filename of attachments to json message handler (#185) --- src/main/java/org/asamk/signal/JsonAttachment.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/asamk/signal/JsonAttachment.java b/src/main/java/org/asamk/signal/JsonAttachment.java index 29e8592e..785fa9e2 100644 --- a/src/main/java/org/asamk/signal/JsonAttachment.java +++ b/src/main/java/org/asamk/signal/JsonAttachment.java @@ -6,14 +6,19 @@ import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPoin class JsonAttachment { String contentType; + String filename; long id; int size; JsonAttachment(SignalServiceAttachment attachment) { this.contentType = attachment.getContentType(); + final SignalServiceAttachmentPointer pointer = attachment.asPointer(); if (attachment.isPointer()) { this.id = pointer.getId(); + if (pointer.getFileName().isPresent()) { + this.filename = pointer.getFileName().get(); + } if (pointer.getSize().isPresent()) { this.size = pointer.getSize().get(); }