X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/e04c45766d50d6a4e2d3c084145e2115b38bef5c..ae41d0c5026fe868c6198e1005344fc78b6e0a2c:/src/main/java/org/asamk/signal/JsonDbusReceiveMessageHandler.java diff --git a/src/main/java/org/asamk/signal/JsonDbusReceiveMessageHandler.java b/src/main/java/org/asamk/signal/JsonDbusReceiveMessageHandler.java index 3ba65f7d..ecb54d07 100644 --- a/src/main/java/org/asamk/signal/JsonDbusReceiveMessageHandler.java +++ b/src/main/java/org/asamk/signal/JsonDbusReceiveMessageHandler.java @@ -9,9 +9,9 @@ import org.whispersystems.signalservice.api.messages.SignalServiceContent; import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage; import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; import org.whispersystems.signalservice.api.messages.SignalServiceGroup; -import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; +import org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage; import org.whispersystems.signalservice.api.messages.multidevice.SentTranscriptMessage; -import org.whispersystems.signalservice.api.push.SignalServiceAddress; +import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage; import java.util.ArrayList; import java.util.List; @@ -40,12 +40,25 @@ public class JsonDbusReceiveMessageHandler extends JsonReceiveMessageHandler { e.printStackTrace(); } } else if (content != null) { - if (content.getDataMessage().isPresent()) { + if (content.getReceiptMessage().isPresent()) { + final SignalServiceReceiptMessage receiptMessage = content.getReceiptMessage().get(); + if (receiptMessage.isDeliveryReceipt()) { + final String sender = !envelope.isUnidentifiedSender() && envelope.hasSource() ? envelope.getSourceE164().get() : content.getSender().getNumber().get(); + for (long timestamp : receiptMessage.getTimestamps()) { + try { + conn.sendSignal(new Signal.ReceiptReceived( + objectPath, + timestamp, + sender + )); + } catch (DBusException e) { + e.printStackTrace(); + } + } + } + } else if (content.getDataMessage().isPresent()) { SignalServiceDataMessage message = content.getDataMessage().get(); - if (message.getBody().isPresent()) - System.out.println(message.getBody().get()); - if (!message.isEndSession() && !(message.getGroupContext().isPresent() && message.getGroupContext().get().getGroupV1Type() != SignalServiceGroup.Type.DELIVER)) {