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