mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Add timestamp to dbus MessageReceived signal
This commit is contained in:
parent
dd934f1304
commit
af8a27e87f
2 changed files with 34 additions and 2 deletions
|
@ -20,8 +20,39 @@ public interface Signal extends DBusInterface {
|
||||||
void sendGroupMessage(String message, List<String> attachments, byte[] groupId) throws EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException, IOException;
|
void sendGroupMessage(String message, List<String> attachments, byte[] groupId) throws EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException, IOException;
|
||||||
|
|
||||||
class MessageReceived extends DBusSignal {
|
class MessageReceived extends DBusSignal {
|
||||||
public MessageReceived(String objectpath, String sender, byte[] groupId, String message, List<String> attachments) throws DBusException {
|
private long timestamp;
|
||||||
super(objectpath, sender, groupId, message, attachments);
|
private String sender;
|
||||||
|
private byte[] groupId;
|
||||||
|
private String message;
|
||||||
|
private List<String> attachments;
|
||||||
|
|
||||||
|
public MessageReceived(String objectpath, long timestamp, String sender, byte[] groupId, String message, List<String> attachments) throws DBusException {
|
||||||
|
super(objectpath, timestamp, sender, groupId, message, attachments);
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
this.sender = sender;
|
||||||
|
this.groupId = groupId;
|
||||||
|
this.message = message;
|
||||||
|
this.attachments = attachments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimestamp() {
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSender() {
|
||||||
|
return sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getGroupId() {
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAttachments() {
|
||||||
|
return attachments;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -603,6 +603,7 @@ public class Main {
|
||||||
try {
|
try {
|
||||||
conn.sendSignal(new Signal.MessageReceived(
|
conn.sendSignal(new Signal.MessageReceived(
|
||||||
SIGNAL_OBJECTPATH,
|
SIGNAL_OBJECTPATH,
|
||||||
|
message.getTimestamp(),
|
||||||
envelope.getSource(),
|
envelope.getSource(),
|
||||||
message.getGroupInfo().isPresent() ? message.getGroupInfo().get().getGroupId() : new byte[0],
|
message.getGroupInfo().isPresent() ? message.getGroupInfo().get().getGroupId() : new byte[0],
|
||||||
message.getBody().isPresent() ? message.getBody().get() : "",
|
message.getBody().isPresent() ? message.getBody().get() : "",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue