X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/e2b7bda65ba728a0a747bb0bac6fbe1e56fd2de8..d520023fc76a522650b7561f2a4fc7a95fb5a04d:/src/main/java/org/asamk/Signal.java diff --git a/src/main/java/org/asamk/Signal.java b/src/main/java/org/asamk/Signal.java index 90d02758..654f365f 100644 --- a/src/main/java/org/asamk/Signal.java +++ b/src/main/java/org/asamk/Signal.java @@ -2,9 +2,9 @@ package org.asamk; import org.asamk.signal.AttachmentInvalidException; import org.asamk.signal.GroupNotFoundException; -import org.freedesktop.dbus.DBusInterface; -import org.freedesktop.dbus.DBusSignal; import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.interfaces.DBusInterface; +import org.freedesktop.dbus.messages.DBusSignal; import org.whispersystems.signalservice.api.push.exceptions.EncapsulatedExceptions; import org.whispersystems.signalservice.api.util.InvalidNumberException; @@ -13,13 +13,13 @@ import java.util.List; public interface Signal extends DBusInterface { - void sendMessage(String message, List attachments, String recipient) throws EncapsulatedExceptions, AttachmentInvalidException, IOException, InvalidNumberException; + long sendMessage(String message, List attachments, String recipient) throws EncapsulatedExceptions, AttachmentInvalidException, IOException, InvalidNumberException; - void sendMessage(String message, List attachments, List recipients) throws EncapsulatedExceptions, AttachmentInvalidException, IOException, InvalidNumberException; + long sendMessage(String message, List attachments, List recipients) throws EncapsulatedExceptions, AttachmentInvalidException, IOException, InvalidNumberException; void sendEndSessionMessage(List recipients) throws IOException, EncapsulatedExceptions, InvalidNumberException; - void sendGroupMessage(String message, List attachments, byte[] groupId) throws EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException, IOException, InvalidNumberException; + long sendGroupMessage(String message, List attachments, byte[] groupId) throws EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException, IOException; String getContactName(String number) throws InvalidNumberException; @@ -96,4 +96,48 @@ public interface Signal extends DBusInterface { return sender; } } + + class SyncMessageReceived extends DBusSignal { + + private long timestamp; + private String source; + private String destination; + private byte[] groupId; + private String message; + private List attachments; + + public SyncMessageReceived(String objectpath, long timestamp, String source, String destination, byte[] groupId, String message, List attachments) throws DBusException { + super(objectpath, timestamp, source, destination, groupId, message, attachments); + this.timestamp = timestamp; + this.source = source; + this.destination = destination; + this.groupId = groupId; + this.message = message; + this.attachments = attachments; + } + + public long getTimestamp() { + return timestamp; + } + + public String getSource() { + return source; + } + + public String getDestination() { + return destination; + } + + public byte[] getGroupId() { + return groupId; + } + + public String getMessage() { + return message; + } + + public List getAttachments() { + return attachments; + } + } }