]> nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/Signal.java
Improve exception handling
[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.crypto.UntrustedIdentityException;
9 import org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptions;
10
11 import java.io.IOException;
12 import java.util.List;
13
14 public interface Signal extends DBusInterface {
15 void sendMessage(String message, List<String> attachments, String recipient) throws EncapsulatedExceptions, AttachmentInvalidException, IOException;
16
17 void sendMessage(String message, List<String> attachments, List<String> recipients) throws EncapsulatedExceptions, AttachmentInvalidException, IOException;
18
19 void sendEndSessionMessage(List<String> recipients) throws IOException, EncapsulatedExceptions;
20
21 void sendGroupMessage(String message, List<String> attachments, byte[] groupId) throws EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException, IOException;
22
23 class MessageReceived extends DBusSignal {
24 private long timestamp;
25 private String sender;
26 private byte[] groupId;
27 private String message;
28 private List<String> attachments;
29
30 public MessageReceived(String objectpath, long timestamp, String sender, byte[] groupId, String message, List<String> attachments) throws DBusException {
31 super(objectpath, timestamp, sender, groupId, message, attachments);
32 this.timestamp = timestamp;
33 this.sender = sender;
34 this.groupId = groupId;
35 this.message = message;
36 this.attachments = attachments;
37 }
38
39 public long getTimestamp() {
40 return timestamp;
41 }
42
43 public String getSender() {
44 return sender;
45 }
46
47 public byte[] getGroupId() {
48 return groupId;
49 }
50
51 public String getMessage() {
52 return message;
53 }
54
55 public List<String> getAttachments() {
56 return attachments;
57 }
58 }
59 }