From 97d54650020608be91d8c1810a251b45af4a6bdf Mon Sep 17 00:00:00 2001 From: adaptivegarage Date: Mon, 5 Apr 2021 15:07:46 +0200 Subject: [PATCH] Implementation of remoteDelete command, iteration 6 --- man/signal-cli-dbus.5.adoc | 48 +++++++++++++++++-- src/main/java/org/asamk/Signal.java | 4 ++ .../org/asamk/signal/dbus/DbusSignalImpl.java | 9 ++++ 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/man/signal-cli-dbus.5.adoc b/man/signal-cli-dbus.5.adoc index e84032bf..fc6cf6d1 100755 --- a/man/signal-cli-dbus.5.adoc +++ b/man/signal-cli-dbus.5.adoc @@ -98,7 +98,7 @@ sendEndSessionMessage(recipients) -> <>:: Exceptions: Failure, InvalidNumber, UntrustedIdentity -sendGroupMessage(message, attachments, groupId) -> timestamp:: +sendGroupMessage(message, attachments, groupId) -> timestamp:: * message : Text to send (can be UTF8) * attachments : String array of filenames to send as attachments (passed as filename, so need to be readable by the user signal-cli is running under) * groupId : Byte array representing the internal group identifier @@ -113,7 +113,7 @@ sendNoteToSelfMessage(message, attachments) -> timestamp:: Exceptions: Failure, AttachmentInvalid -sendMessage(message, attachments, recipient timestamp:: +sendMessage(message, attachments, recipient) -> timestamp:: sendMessage(message, attachments, recipients) -> timestamp:: * message : Text to send (can be UTF8) * attachments : String array of filenames to send as attachments (passed as filename, so need to be readable by the user signal-cli is running under) @@ -123,7 +123,49 @@ sendMessage(message, attachments, recipients) -> timestamp:: Depending on the type of the recipient field this sends a message to one or multiple recipients. -Expections: AttachmentInvalid, Failure, InvalidNumber, UntrustedIdentity +Exceptions: AttachmentInvalid, Failure, InvalidNumber, UntrustedIdentity + +sendGroupMessageReaction(emoji, remove, targetAuthor, targetSentTimestamp, groupId) -> timestamp:: +* emoji : Unicode grapheme cluster of the emoji +* remove : Boolean, whether a previously sent reaction (emoji) should be removed +* targetAuthor : String with the phone number of the author of the message to which to react +* targetSentTimestamp : Long representing timestamp of the message to which to react +* groupId : Byte array with base64 encoded group identifier +* timestamp : Long, can be used to identify the corresponding signal reply + +Exceptions: Failure, InvalidNumber, GroupNotFound + +sendMessageReaction(emoji, remove, targetAuthor, targetSentTimestamp, recipient) -> timestamp:: +sendMessageReaction(emoji, remove, targetAuthor, targetSentTimestamp, recipients) -> timestamp:: +* emoji : Unicode grapheme cluster of the emoji +* remove : Boolean, whether a previously sent reaction (emoji) should be removed +* targetAuthor : String with the phone number of the author of the message to which to react +* targetSentTimestamp : Long representing timestamp of the message to which to react +* recipient : String with the phone number of a single recipient +* recipients : Array of strings with phone numbers, should there be more recipients +* timestamp : Long, can be used to identify the corresponding signal reply + +Depending on the type of the recipient(s) field this sends a reaction to one or multiple recipients. + +Exceptions: Failure, InvalidNumber + +remoteGroupDelete(targetSentTimestamp, groupId) -> timestamp:: +* targetSentTimestamp : Long representing timestamp of the message to delete +* groupId : Byte array with base64 encoded group identifier +* timestamp : Long, can be used to identify the corresponding signal reply + +Exceptions: Failure, GroupNotFound + +remoteDelete(targetSentTimestamp, recipient) -> timestamp:: +remoteDelete(targetSentTimestamp, recipients) -> timestamp:: +* targetSentTimestamp : Long representing timestamp of the message to delete +* recipient : String with the phone number of a single recipient +* recipients : Array of strings with phone numbers, should there be more recipients +* timestamp : Long, can be used to identify the corresponding signal reply + +Depending on the type of the recipient(s) field this deletes a message with one or multiple recipients. + +Exceptions: Failure, InvalidNumber getContactName(number) -> name:: * number : Phone number diff --git a/src/main/java/org/asamk/Signal.java b/src/main/java/org/asamk/Signal.java index 717d137a..7a433bbc 100644 --- a/src/main/java/org/asamk/Signal.java +++ b/src/main/java/org/asamk/Signal.java @@ -21,6 +21,10 @@ public interface Signal extends DBusInterface { String message, List attachments, List recipients ) throws Error.AttachmentInvalid, Error.Failure, Error.InvalidNumber, Error.UntrustedIdentity; + long remoteDelete( + long targetSentTimestamp, String recipient + ) throws Error.Failure, Error.InvalidNumber; + long remoteDelete( long targetSentTimestamp, List recipients ) throws Error.Failure, Error.InvalidNumber; diff --git a/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java b/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java index 50a84dd3..3ce9ef81 100644 --- a/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java +++ b/src/main/java/org/asamk/signal/dbus/DbusSignalImpl.java @@ -103,6 +103,15 @@ public class DbusSignalImpl implements Signal { } } + @Override + public long remoteDelete( + final long targetSentTimestamp, final String recipient + ) { + var recipients = new ArrayList(1); + recipients.add(recipient); + return remoteDelete(targetSentTimestamp, recipients); + } + @Override public long remoteDelete( final long targetSentTimestamp, final List recipients