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