Expose filename of attachments to json message handler (#185)

This commit is contained in:
Parker Higgins 2019-01-09 14:17:45 -05:00 committed by AsamK
parent a055f282c6
commit 58895aaf03

View file

@ -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();
}