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