mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Implement json output for receive
This commit is contained in:
parent
a1f0d74a99
commit
8717665d1d
9 changed files with 225 additions and 2 deletions
21
src/main/java/org/asamk/signal/JsonAttachment.java
Normal file
21
src/main/java/org/asamk/signal/JsonAttachment.java
Normal file
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue