]> nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/Signal.java
Make fields final for DBusSignal classes
[signal-cli] / src / main / java / org / asamk / Signal.java
1 package org.asamk;
2
3 import org.asamk.signal.AttachmentInvalidException;
4 import org.asamk.signal.GroupNotFoundException;
5 import org.freedesktop.dbus.exceptions.DBusException;
6 import org.freedesktop.dbus.interfaces.DBusInterface;
7 import org.freedesktop.dbus.messages.DBusSignal;
8 import org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptions;
9 import org.whispersystems.signalservice.api.util.InvalidNumberException;
10
11 import java.io.IOException;
12 import java.util.List;
13
14 public interface Signal extends DBusInterface {
15
16 long sendMessage(String message, List<String> attachments, String recipient) throws EncapsulatedExceptions, AttachmentInvalidException, IOException, InvalidNumberException;
17
18 long sendMessage(String message, List<String> attachments, List<String> recipients) throws EncapsulatedExceptions, AttachmentInvalidException, IOException, InvalidNumberException;
19
20 void sendEndSessionMessage(List<String> recipients) throws IOException, EncapsulatedExceptions, InvalidNumberException;
21
22 long sendGroupMessage(String message, List<String> attachments, byte[] groupId) throws EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException, IOException;
23
24 String getContactName(String number) throws InvalidNumberException;
25
26 void setContactName(String number, String name) throws InvalidNumberException;
27
28 void setContactBlocked(String number, boolean blocked) throws InvalidNumberException;
29
30 void setGroupBlocked(byte[] groupId, boolean blocked) throws GroupNotFoundException;
31
32 List<byte[]> getGroupIds();
33
34 String getGroupName(byte[] groupId);
35
36 List<String> getGroupMembers(byte[] groupId);
37
38 byte[] updateGroup(byte[] groupId, String name, List<String> members, String avatar) throws IOException, EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException, InvalidNumberException;
39
40 boolean isRegistered();
41
42 class MessageReceived extends DBusSignal {
43
44 private final long timestamp;
45 private final String sender;
46 private final byte[] groupId;
47 private final String message;
48 private final List<String> attachments;
49
50 public MessageReceived(String objectpath, long timestamp, String sender, byte[] groupId, String message, List<String> attachments) throws DBusException {
51 super(objectpath, timestamp, sender, groupId, message, attachments);
52 this.timestamp = timestamp;
53 this.sender = sender;
54 this.groupId = groupId;
55 this.message = message;
56 this.attachments = attachments;
57 }
58
59 public long getTimestamp() {
60 return timestamp;
61 }
62
63 public String getSender() {
64 return sender;
65 }
66
67 public byte[] getGroupId() {
68 return groupId;
69 }
70
71 public String getMessage() {
72 return message;
73 }
74
75 public List<String> getAttachments() {
76 return attachments;
77 }
78 }
79
80 class ReceiptReceived extends DBusSignal {
81
82 private final long timestamp;
83 private final String sender;
84
85 public ReceiptReceived(String objectpath, long timestamp, String sender) throws DBusException {
86 super(objectpath, timestamp, sender);
87 this.timestamp = timestamp;
88 this.sender = sender;
89 }
90
91 public long getTimestamp() {
92 return timestamp;
93 }
94
95 public String getSender() {
96 return sender;
97 }
98 }
99
100 class SyncMessageReceived extends DBusSignal {
101
102 private final long timestamp;
103 private final String source;
104 private final String destination;
105 private final byte[] groupId;
106 private final String message;
107 private final List<String> attachments;
108
109 public SyncMessageReceived(String objectpath, long timestamp, String source, String destination, byte[] groupId, String message, List<String> attachments) throws DBusException {
110 super(objectpath, timestamp, source, destination, groupId, message, attachments);
111 this.timestamp = timestamp;
112 this.source = source;
113 this.destination = destination;
114 this.groupId = groupId;
115 this.message = message;
116 this.attachments = attachments;
117 }
118
119 public long getTimestamp() {
120 return timestamp;
121 }
122
123 public String getSource() {
124 return source;
125 }
126
127 public String getDestination() {
128 return destination;
129 }
130
131 public byte[] getGroupId() {
132 return groupId;
133 }
134
135 public String getMessage() {
136 return message;
137 }
138
139 public List<String> getAttachments() {
140 return attachments;
141 }
142 }
143 }