]> nmode's Git Repositories - signal-cli/commitdiff
implement viewedReceipt
authorJohn Freed <okgithub@johnfreed.com>
Thu, 7 Oct 2021 05:40:20 +0000 (07:40 +0200)
committerJohn Freed <okgithub@johnfreed.com>
Thu, 7 Oct 2021 05:40:20 +0000 (07:40 +0200)
for Dbus and Json -- note that this changes the JsonReceiptMessage
structure

update documentation

man/signal-cli-dbus.5.adoc
src/main/java/org/asamk/Signal.java
src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java
src/main/java/org/asamk/signal/json/JsonReceiptMessage.java

index e7cd083f16305891151f167b6dec0dffcaa370d8..093f5807a70316493726a36839dadaa2338cbaac 100755 (executable)
@@ -212,13 +212,18 @@ sendTyping(recipient<s>, stop<b>) -> <>::
 
 Exceptions: Failure, GroupNotFound, UntrustedIdentity
 
-
 sendReadReceipt(recipient<s>, targetSentTimestamp<ax>) -> <>::
 * recipient             : Phone number of a single recipient
 * targetSentTimestamp   : Array of Longs to identify the corresponding signal messages
 
 Exceptions: Failure, UntrustedIdentity
 
+sendViewedReceipt(recipient<s>, targetSentTimestamp<ax>) -> <>::
+* recipient             : Phone number of a single recipient
+* targetSentTimestamp   : Array of Longs to identify the corresponding signal messages
+
+Exceptions: Failure, UntrustedIdentity
+
 sendGroupMessageReaction(emoji<s>, remove<b>, targetAuthor<s>, targetSentTimestamp<x>, groupId<ay>) -> timestamp<x>::
 * emoji               : Unicode grapheme cluster of the emoji
 * remove              : Boolean, whether a previously sent reaction (emoji) should be removed
index b88000858c38e1b4b1b15c82e782ae2e49157263..dad7d5d7c751defb9b92d78419a0fe025678a394 100644 (file)
@@ -34,6 +34,10 @@ public interface Signal extends DBusInterface {
             String recipient, List<Long> messageIds
     ) throws Error.Failure, Error.UntrustedIdentity;
 
+    void sendViewedReceipt(
+            String recipient, List<Long> messageIds
+    ) throws Error.Failure, Error.UntrustedIdentity;
+
     long sendRemoteDeleteMessage(
             long targetSentTimestamp, String recipient
     ) throws Error.Failure, Error.InvalidNumber;
index ab9c89b2ee6afd3f087356d7bfcbece2a5b60bd5..18565a0d1daaa38b4d650dd91ca02106cbb84ede 100644 (file)
@@ -282,6 +282,19 @@ public class DbusSignalImpl implements Signal {
         }
     }
 
+    @Override
+    public void sendViewedReceipt(
+            final String recipient, final List<Long> messageIds
+    ) throws Error.Failure, Error.UntrustedIdentity {
+        try {
+            m.sendViewedReceipt(getSingleRecipientIdentifier(recipient, m.getSelfNumber()), messageIds);
+        } catch (IOException e) {
+            throw new Error.Failure(e.getMessage());
+        } catch (UntrustedIdentityException e) {
+            throw new Error.UntrustedIdentity(e.getMessage());
+        }
+    }
+
     @Override
     public void sendContacts() {
         try {
index e32009e13c72879d3f07b39ab71b32c769d897e6..54869d25d49a0e3645219d1f06daeed5a69a5f50 100644 (file)
@@ -17,6 +17,9 @@ class JsonReceiptMessage {
     @JsonProperty
     final boolean isRead;
 
+    @JsonProperty
+    final boolean isViewed;
+
     @JsonProperty
     final List<Long> timestamps;
 
@@ -24,6 +27,7 @@ class JsonReceiptMessage {
         this.when = receiptMessage.getWhen();
         this.isDelivery = receiptMessage.isDeliveryReceipt();
         this.isRead = receiptMessage.isReadReceipt();
+        this.isViewed = receiptMessage.isViewedReceipt();
         this.timestamps = receiptMessage.getTimestamps();
     }
 
@@ -33,6 +37,7 @@ class JsonReceiptMessage {
         this.when = when;
         this.isDelivery = isDelivery;
         this.isRead = isRead;
+        this.isViewed = isViewed;
         this.timestamps = timestamps;
     }