return attachments;
}
}
+
+ class ReceiptReceived extends DBusSignal {
+ private long timestamp;
+ private String sender;
+
+ public ReceiptReceived(String objectpath, long timestamp, String sender) throws DBusException {
+ super(objectpath, timestamp, sender);
+ this.timestamp = timestamp;
+ this.sender = sender;
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public String getSender() {
+ return sender;
+ }
+ }
}
System.out.println();
}
});
+ dBusConn.addSigHandler(Signal.ReceiptReceived.class, new DBusSigHandler<Signal.ReceiptReceived>() {
+ @Override
+ public void handle(Signal.ReceiptReceived s) {
+ System.out.print(String.format("Receipt from: %s\nTimestamp: %s\n",
+ s.getSender(), formatTimestamp(s.getTimestamp())));
+ }
+ });
} catch (UnsatisfiedLinkError e) {
System.err.println("Missing native library dependency for dbus service: " + e.getMessage());
return 1;
public void handleMessage(SignalServiceEnvelope envelope, SignalServiceContent content, Throwable exception) {
super.handleMessage(envelope, content, exception);
- if (!envelope.isReceipt() && content != null && content.getDataMessage().isPresent()) {
+ if (envelope.isReceipt()) {
+ try {
+ conn.sendSignal(new Signal.ReceiptReceived(
+ SIGNAL_OBJECTPATH,
+ envelope.getTimestamp(),
+ envelope.getSource()
+ ));
+ } catch (DBusException e) {
+ e.printStackTrace();
+ }
+ } else if (content != null && content.getDataMessage().isPresent()) {
SignalServiceDataMessage message = content.getDataMessage().get();
if (!message.isEndSession() &&