3 import org
.asamk
.Signal
.Error
;
4 import org
.freedesktop
.dbus
.exceptions
.DBusException
;
5 import org
.freedesktop
.dbus
.exceptions
.DBusExecutionException
;
6 import org
.freedesktop
.dbus
.interfaces
.DBusInterface
;
7 import org
.freedesktop
.dbus
.messages
.DBusSignal
;
8 import org
.whispersystems
.libsignal
.util
.guava
.Optional
;
10 import java
.io
.IOException
;
11 import java
.util
.List
;
14 * DBus interface for the org.asamk.Signal service.
15 * Including emitted Signals and returned Errors.
17 public interface Signal
extends DBusInterface
{
20 String message
, List
<String
> attachments
, String recipient
21 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
24 String message
, List
<String
> attachments
, List
<String
> recipients
25 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
28 String recipient
, boolean stop
29 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.UntrustedIdentity
;
32 String recipient
, List
<Long
> targetSentTimestamp
33 ) throws Error
.Failure
, Error
.UntrustedIdentity
;
35 long sendRemoteDeleteMessage(
36 long targetSentTimestamp
, String recipient
37 ) throws Error
.Failure
, Error
.InvalidNumber
;
39 long sendRemoteDeleteMessage(
40 long targetSentTimestamp
, List
<String
> recipients
41 ) throws Error
.Failure
, Error
.InvalidNumber
;
43 long sendGroupRemoteDeleteMessage(
44 long targetSentTimestamp
, byte[] groupId
45 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
47 long sendMessageReaction(
48 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, String recipient
49 ) throws Error
.InvalidNumber
, Error
.Failure
;
51 long sendMessageReaction(
52 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, List
<String
> recipients
53 ) throws Error
.InvalidNumber
, Error
.Failure
;
55 long sendNoteToSelfMessage(
56 String message
, List
<String
> attachments
57 ) throws Error
.AttachmentInvalid
, Error
.Failure
;
59 void sendEndSessionMessage(List
<String
> recipients
) throws Error
.Failure
, Error
.InvalidNumber
, Error
.UntrustedIdentity
;
61 long sendGroupMessage(
62 String message
, List
<String
> attachments
, byte[] groupId
63 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.AttachmentInvalid
, Error
.InvalidGroupId
;
65 long sendGroupMessageReaction(
66 String emoji
, boolean remove
, String targetAuthor
, long targetSentTimestamp
, byte[] groupId
67 ) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidNumber
, Error
.InvalidGroupId
;
69 String
getContactName(String number
) throws Error
.InvalidNumber
;
71 void setContactName(String number
, String name
) throws Error
.InvalidNumber
;
73 void setContactBlocked(String number
, boolean blocked
) throws Error
.InvalidNumber
;
75 void setGroupBlocked(byte[] groupId
, boolean blocked
) throws Error
.GroupNotFound
, Error
.InvalidGroupId
;
77 List
<byte[]> getGroupIds();
79 String
getGroupName(byte[] groupId
) throws Error
.InvalidGroupId
;
81 List
<String
> getGroupMembers(byte[] groupId
) throws Error
.InvalidGroupId
;
84 byte[] groupId
, String name
, List
<String
> members
, String avatar
85 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.InvalidNumber
, Error
.GroupNotFound
, Error
.InvalidGroupId
;
87 boolean isRegistered();
90 String name
, String about
, String aboutEmoji
, String avatarPath
, boolean removeAvatar
91 ) throws Error
.Failure
;
95 void setPin(String registrationLockPin
);
99 List
<String
> listNumbers();
101 List
<String
> getContactNumber(final String name
) throws Error
.Failure
;
103 void quitGroup(final byte[] groupId
) throws Error
.GroupNotFound
, Error
.Failure
, Error
.InvalidGroupId
;
105 boolean isContactBlocked(final String number
) throws Error
.InvalidNumber
;
107 boolean isGroupBlocked(final byte[] groupId
) throws Error
.InvalidGroupId
;
109 boolean isMember(final byte[] groupId
) throws Error
.InvalidGroupId
;
111 byte[] joinGroup(final String groupLink
) throws Error
.Failure
;
113 class MessageReceived
extends DBusSignal
{
115 private final long timestamp
;
116 private final String sender
;
117 private final byte[] groupId
;
118 private final String message
;
119 private final List
<String
> attachments
;
121 public MessageReceived(
127 List
<String
> attachments
128 ) throws DBusException
{
129 super(objectpath
, timestamp
, sender
, groupId
, message
, attachments
);
130 this.timestamp
= timestamp
;
131 this.sender
= sender
;
132 this.groupId
= groupId
;
133 this.message
= message
;
134 this.attachments
= attachments
;
137 public long getTimestamp() {
141 public String
getSender() {
145 public byte[] getGroupId() {
149 public String
getMessage() {
153 public List
<String
> getAttachments() {
158 class ReceiptReceived
extends DBusSignal
{
160 private final long timestamp
;
161 private final String sender
;
163 public ReceiptReceived(String objectpath
, long timestamp
, String sender
) throws DBusException
{
164 super(objectpath
, timestamp
, sender
);
165 this.timestamp
= timestamp
;
166 this.sender
= sender
;
169 public long getTimestamp() {
173 public String
getSender() {
178 class SyncMessageReceived
extends DBusSignal
{
180 private final long timestamp
;
181 private final String source
;
182 private final String destination
;
183 private final byte[] groupId
;
184 private final String message
;
185 private final List
<String
> attachments
;
187 public SyncMessageReceived(
194 List
<String
> attachments
195 ) throws DBusException
{
196 super(objectpath
, timestamp
, source
, destination
, groupId
, message
, attachments
);
197 this.timestamp
= timestamp
;
198 this.source
= source
;
199 this.destination
= destination
;
200 this.groupId
= groupId
;
201 this.message
= message
;
202 this.attachments
= attachments
;
205 public long getTimestamp() {
209 public String
getSource() {
213 public String
getDestination() {
217 public byte[] getGroupId() {
221 public String
getMessage() {
225 public List
<String
> getAttachments() {
232 class AttachmentInvalid
extends DBusExecutionException
{
234 public AttachmentInvalid(final String message
) {
239 class Failure
extends DBusExecutionException
{
241 public Failure(final String message
) {
246 class GroupNotFound
extends DBusExecutionException
{
248 public GroupNotFound(final String message
) {
253 class InvalidGroupId
extends DBusExecutionException
{
255 public InvalidGroupId(final String message
) {
260 class InvalidNumber
extends DBusExecutionException
{
262 public InvalidNumber(final String message
) {
267 class UntrustedIdentity
extends DBusExecutionException
{
269 public UntrustedIdentity(final String message
) {