X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/8f4d89e2f7e2658e4b6d28970fa447dff32a0a26..d622967192ce03d3650f2cbc582c6555ab0ca23c:/src/main/java/org/asamk/Signal.java diff --git a/src/main/java/org/asamk/Signal.java b/src/main/java/org/asamk/Signal.java index 6e76f4a7..a30f8f3b 100644 --- a/src/main/java/org/asamk/Signal.java +++ b/src/main/java/org/asamk/Signal.java @@ -1,10 +1,13 @@ package org.asamk; +import org.asamk.Signal.Error; import org.freedesktop.dbus.exceptions.DBusException; import org.freedesktop.dbus.exceptions.DBusExecutionException; import org.freedesktop.dbus.interfaces.DBusInterface; import org.freedesktop.dbus.messages.DBusSignal; +import org.whispersystems.libsignal.util.guava.Optional; +import java.io.IOException; import java.util.List; /** @@ -21,6 +24,26 @@ public interface Signal extends DBusInterface { String message, List attachments, List recipients ) throws Error.AttachmentInvalid, Error.Failure, Error.InvalidNumber, Error.UntrustedIdentity; + void sendTyping( + String recipient, boolean stop + ) throws Error.Failure, Error.GroupNotFound, Error.UntrustedIdentity; + + void sendReadReceipt( + String recipient, List targetSentTimestamp + ) throws Error.Failure, Error.UntrustedIdentity; + + long sendRemoteDeleteMessage( + long targetSentTimestamp, String recipient + ) throws Error.Failure, Error.InvalidNumber; + + long sendRemoteDeleteMessage( + long targetSentTimestamp, List recipients + ) throws Error.Failure, Error.InvalidNumber; + + long sendGroupRemoteDeleteMessage( + long targetSentTimestamp, byte[] groupId + ) throws Error.Failure, Error.GroupNotFound, Error.InvalidGroupId; + long sendMessageReaction( String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, String recipient ) throws Error.InvalidNumber, Error.Failure; @@ -37,11 +60,11 @@ public interface Signal extends DBusInterface { long sendGroupMessage( String message, List attachments, byte[] groupId - ) throws Error.GroupNotFound, Error.Failure, Error.AttachmentInvalid; + ) throws Error.GroupNotFound, Error.Failure, Error.AttachmentInvalid, Error.InvalidGroupId; long sendGroupMessageReaction( String emoji, boolean remove, String targetAuthor, long targetSentTimestamp, byte[] groupId - ) throws Error.GroupNotFound, Error.Failure, Error.InvalidNumber; + ) throws Error.GroupNotFound, Error.Failure, Error.InvalidNumber, Error.InvalidGroupId; String getContactName(String number) throws Error.InvalidNumber; @@ -49,17 +72,17 @@ public interface Signal extends DBusInterface { void setContactBlocked(String number, boolean blocked) throws Error.InvalidNumber; - void setGroupBlocked(byte[] groupId, boolean blocked) throws Error.GroupNotFound; + void setGroupBlocked(byte[] groupId, boolean blocked) throws Error.GroupNotFound, Error.InvalidGroupId; List getGroupIds(); - String getGroupName(byte[] groupId); + String getGroupName(byte[] groupId) throws Error.InvalidGroupId; - List getGroupMembers(byte[] groupId); + List getGroupMembers(byte[] groupId) throws Error.InvalidGroupId; byte[] updateGroup( byte[] groupId, String name, List members, String avatar - ) throws Error.AttachmentInvalid, Error.Failure, Error.InvalidNumber, Error.GroupNotFound; + ) throws Error.AttachmentInvalid, Error.Failure, Error.InvalidNumber, Error.GroupNotFound, Error.InvalidGroupId; boolean isRegistered(); @@ -67,21 +90,25 @@ public interface Signal extends DBusInterface { String name, String about, String aboutEmoji, String avatarPath, boolean removeAvatar ) throws Error.Failure; - public String version(); + void removePin(); + + void setPin(String registrationLockPin); - public List listNumbers(); + String version(); - public List getContactNumber(final String name) throws Error.Failure; + List listNumbers(); - public void quitGroup(final byte[] groupId) throws Error.GroupNotFound, Error.Failure; + List getContactNumber(final String name) throws Error.Failure; - public boolean isContactBlocked(final String number); + void quitGroup(final byte[] groupId) throws Error.GroupNotFound, Error.Failure, Error.InvalidGroupId; - public boolean isGroupBlocked(final byte[] groupId); + boolean isContactBlocked(final String number) throws Error.InvalidNumber; - public boolean isMember(final byte[] groupId); + boolean isGroupBlocked(final byte[] groupId) throws Error.InvalidGroupId; - public void joinGroup(final String groupLink) throws Error.Failure; + boolean isMember(final byte[] groupId) throws Error.InvalidGroupId; + + byte[] joinGroup(final String groupLink) throws Error.Failure; class MessageReceived extends DBusSignal { @@ -223,6 +250,13 @@ public interface Signal extends DBusInterface { } } + class InvalidGroupId extends DBusExecutionException { + + public InvalidGroupId(final String message) { + super(message); + } + } + class InvalidNumber extends DBusExecutionException { public InvalidNumber(final String message) {