X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/a1f0d74a99e4dc5c2e7a7ee79f59684314da4c4f..8717665d1d273a32afef136c15c0d5abaaae0f85:/src/main/java/org/asamk/signal/JsonAttachment.java diff --git a/src/main/java/org/asamk/signal/JsonAttachment.java b/src/main/java/org/asamk/signal/JsonAttachment.java new file mode 100644 index 00000000..53946df9 --- /dev/null +++ b/src/main/java/org/asamk/signal/JsonAttachment.java @@ -0,0 +1,21 @@ +package org.asamk.signal; + +import org.whispersystems.signalservice.api.messages.SignalServiceAttachment; +import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer; + +class JsonAttachment { + String contentType; + 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.getSize().isPresent()) { + this.size = pointer.getSize().get(); + } + } + } +}