]> nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/Signal.java
Return message timestamp after sucessfully sending a message
[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.DBusInterface;
6 import org.freedesktop.dbus.DBusSignal;
7 import org.freedesktop.dbus.exceptions.DBusException;
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 long timestamp;
45 private String sender;
46 private byte[] groupId;
47 private String message;
48 private 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 long timestamp;
83 private 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 private long timestamp;
102 private String source;
103 private String destination;
104 private byte[] groupId;
105 private String message;
106 private List<String> attachments;
107
108 public SyncMessageReceived(String objectpath, long timestamp, String source, String destination, byte[] groupId, String message, List<String> attachments) throws DBusException {
109 super(objectpath, timestamp, source, destination, groupId, message, attachments);
110 this.timestamp = timestamp;
111 this.source = source;
112 this.destination = destination;
113 this.groupId = groupId;
114 this.message = message;
115 this.attachments = attachments;
116 }
117
118 public long getTimestamp() {
119 return timestamp;
120 }
121
122 public String getSource() {
123 return source;
124 }
125
126 public String getDestination() {
127 return destination;
128 }
129
130 public byte[] getGroupId() {
131 return groupId;
132 }
133
134 public String getMessage() {
135 return message;
136 }
137
138 public List<String> getAttachments() {
139 return attachments;
140 }
141 }
142 }