mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Add dbus signal handler on specific object
Otherwise the messages from all exported objects would be received Fixes #635
This commit is contained in:
parent
1ce1ae91be
commit
a257a2f7b5
1 changed files with 6 additions and 6 deletions
|
@ -65,19 +65,19 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
|
||||||
if (inJson) {
|
if (inJson) {
|
||||||
final var jsonWriter = new JsonWriter(System.out);
|
final var jsonWriter = new JsonWriter(System.out);
|
||||||
|
|
||||||
dbusconnection.addSigHandler(Signal.MessageReceived.class, messageReceived -> {
|
dbusconnection.addSigHandler(Signal.MessageReceived.class, signal, messageReceived -> {
|
||||||
var envelope = new JsonMessageEnvelope(messageReceived);
|
var envelope = new JsonMessageEnvelope(messageReceived);
|
||||||
final var object = Map.of("envelope", envelope);
|
final var object = Map.of("envelope", envelope);
|
||||||
jsonWriter.write(object);
|
jsonWriter.write(object);
|
||||||
});
|
});
|
||||||
|
|
||||||
dbusconnection.addSigHandler(Signal.ReceiptReceived.class, receiptReceived -> {
|
dbusconnection.addSigHandler(Signal.ReceiptReceived.class, signal, receiptReceived -> {
|
||||||
var envelope = new JsonMessageEnvelope(receiptReceived);
|
var envelope = new JsonMessageEnvelope(receiptReceived);
|
||||||
final var object = Map.of("envelope", envelope);
|
final var object = Map.of("envelope", envelope);
|
||||||
jsonWriter.write(object);
|
jsonWriter.write(object);
|
||||||
});
|
});
|
||||||
|
|
||||||
dbusconnection.addSigHandler(Signal.SyncMessageReceived.class, syncReceived -> {
|
dbusconnection.addSigHandler(Signal.SyncMessageReceived.class, signal, syncReceived -> {
|
||||||
var envelope = new JsonMessageEnvelope(syncReceived);
|
var envelope = new JsonMessageEnvelope(syncReceived);
|
||||||
final var object = Map.of("envelope", envelope);
|
final var object = Map.of("envelope", envelope);
|
||||||
jsonWriter.write(object);
|
jsonWriter.write(object);
|
||||||
|
@ -85,7 +85,7 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
|
||||||
} else {
|
} else {
|
||||||
final var writer = new PlainTextWriterImpl(System.out);
|
final var writer = new PlainTextWriterImpl(System.out);
|
||||||
|
|
||||||
dbusconnection.addSigHandler(Signal.MessageReceived.class, messageReceived -> {
|
dbusconnection.addSigHandler(Signal.MessageReceived.class, signal, messageReceived -> {
|
||||||
writer.println("Envelope from: {}", messageReceived.getSender());
|
writer.println("Envelope from: {}", messageReceived.getSender());
|
||||||
writer.println("Timestamp: {}", DateUtils.formatTimestamp(messageReceived.getTimestamp()));
|
writer.println("Timestamp: {}", DateUtils.formatTimestamp(messageReceived.getTimestamp()));
|
||||||
writer.println("Body: {}", messageReceived.getMessage());
|
writer.println("Body: {}", messageReceived.getMessage());
|
||||||
|
@ -103,12 +103,12 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
|
||||||
writer.println();
|
writer.println();
|
||||||
});
|
});
|
||||||
|
|
||||||
dbusconnection.addSigHandler(Signal.ReceiptReceived.class, receiptReceived -> {
|
dbusconnection.addSigHandler(Signal.ReceiptReceived.class, signal, receiptReceived -> {
|
||||||
writer.println("Receipt from: {}", receiptReceived.getSender());
|
writer.println("Receipt from: {}", receiptReceived.getSender());
|
||||||
writer.println("Timestamp: {}", DateUtils.formatTimestamp(receiptReceived.getTimestamp()));
|
writer.println("Timestamp: {}", DateUtils.formatTimestamp(receiptReceived.getTimestamp()));
|
||||||
});
|
});
|
||||||
|
|
||||||
dbusconnection.addSigHandler(Signal.SyncMessageReceived.class, syncReceived -> {
|
dbusconnection.addSigHandler(Signal.SyncMessageReceived.class, signal, syncReceived -> {
|
||||||
writer.println("Sync Envelope from: {} to: {}",
|
writer.println("Sync Envelope from: {} to: {}",
|
||||||
syncReceived.getSource(),
|
syncReceived.getSource(),
|
||||||
syncReceived.getDestination());
|
syncReceived.getDestination());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue