mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Added ReceiptMessage to JSON output
This commit is contained in:
parent
625034b2d2
commit
7e267f1ebb
2 changed files with 29 additions and 0 deletions
|
@ -14,6 +14,7 @@ class JsonMessageEnvelope {
|
|||
JsonDataMessage dataMessage;
|
||||
JsonSyncMessage syncMessage;
|
||||
JsonCallMessage callMessage;
|
||||
JsonReceiptMessage receiptMessage;
|
||||
|
||||
public JsonMessageEnvelope(SignalServiceEnvelope envelope, SignalServiceContent content) {
|
||||
SignalServiceAddress source = envelope.getSourceAddress();
|
||||
|
@ -32,6 +33,9 @@ class JsonMessageEnvelope {
|
|||
if (content.getCallMessage().isPresent()) {
|
||||
this.callMessage = new JsonCallMessage(content.getCallMessage().get());
|
||||
}
|
||||
if (content.getReceiptMessage().isPresent()) {
|
||||
this.receiptMessage = new JsonReceiptMessage(content.getReceiptMessage().get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
25
src/main/java/org/asamk/signal/JsonReceiptMessage.java
Normal file
25
src/main/java/org/asamk/signal/JsonReceiptMessage.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package org.asamk.signal;
|
||||
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
class JsonReceiptMessage {
|
||||
|
||||
long when;
|
||||
boolean isDelivery;
|
||||
boolean isRead;
|
||||
List<Long> timestamps;
|
||||
|
||||
JsonReceiptMessage(SignalServiceReceiptMessage receiptMessage) {
|
||||
|
||||
this.when = receiptMessage.getWhen();
|
||||
if (receiptMessage.isDeliveryReceipt()) {
|
||||
this.isDelivery = true;
|
||||
}
|
||||
if (receiptMessage.isReadReceipt()) {
|
||||
this.isRead = true;
|
||||
}
|
||||
this.timestamps = receiptMessage.getTimestamps();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue