]> nmode's Git Repositories - signal-cli/blob - src/main/java/org/asamk/Signal.java
6fb59303aa3e178c3721e11c8ca1fd1e1b2d8359
[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
10 import java.io.IOException;
11 import java.util.List;
12
13 public interface Signal extends DBusInterface {
14
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 String getContactName(String number);
24
25 void setContactName(String number, String name);
26
27 List<byte[]> getGroupIds();
28
29 String getGroupName(byte[] groupId);
30
31 List<String> getGroupMembers(byte[] groupId);
32
33 byte[] updateGroup(byte[] groupId, String name, List<String> members, String avatar) throws IOException, EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException;
34
35 boolean isRegistered();
36
37 class MessageReceived extends DBusSignal {
38
39 private long timestamp;
40 private String sender;
41 private byte[] groupId;
42 private String message;
43 private List<String> attachments;
44
45 public MessageReceived(String objectpath, long timestamp, String sender, byte[] groupId, String message, List<String> attachments) throws DBusException {
46 super(objectpath, timestamp, sender, groupId, message, attachments);
47 this.timestamp = timestamp;
48 this.sender = sender;
49 this.groupId = groupId;
50 this.message = message;
51 this.attachments = attachments;
52 }
53
54 public long getTimestamp() {
55 return timestamp;
56 }
57
58 public String getSender() {
59 return sender;
60 }
61
62 public byte[] getGroupId() {
63 return groupId;
64 }
65
66 public String getMessage() {
67 return message;
68 }
69
70 public List<String> getAttachments() {
71 return attachments;
72 }
73 }
74
75 class ReceiptReceived extends DBusSignal {
76
77 private long timestamp;
78 private String sender;
79
80 public ReceiptReceived(String objectpath, long timestamp, String sender) throws DBusException {
81 super(objectpath, timestamp, sender);
82 this.timestamp = timestamp;
83 this.sender = sender;
84 }
85
86 public long getTimestamp() {
87 return timestamp;
88 }
89
90 public String getSender() {
91 return sender;
92 }
93 }
94 }