From db5d63e52e197c5bf85775c093ee65b471afe212 Mon Sep 17 00:00:00 2001 From: AsamK Date: Tue, 8 May 2018 22:18:24 +0200 Subject: [PATCH] Updated DBus service (markdown) --- DBus-service.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/DBus-service.md b/DBus-service.md index 1f118d5..c931217 100644 --- a/DBus-service.md +++ b/DBus-service.md @@ -37,3 +37,25 @@ To avoid the startup time of the JVM for the dbus client, you can use any dbus c Example with `dbus-send`: dbus-send --session --type=method_call --print-reply --dest="org.asamk.Signal" /org/asamk/Signal org.asamk.Signal.sendMessage string:MessageText array:string: string:RECIPIENT + + +### Receive messages from signal-cli daemon +The signal-cli daemon publishes new messages to dbus. +Here's an example using python: + +```python3 +def msgRcv (timestamp, source, groupID, message, attachments): + print ("Message", message, "received in group", signal.getGroupName (groupID)) + return + +from pydbus import SystemBus +from gi.repository import GLib + +bus = SystemBus() +loop = GLib.MainLoop() + +signal = bus.get('org.asamk.Signal') + +signal.onMessageReceived = msgRcv +loop.run() +``` \ No newline at end of file