mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-09-01 06:28:11 +00:00
Updated DBus service (markdown)
parent
6e432402a4
commit
db5d63e52e
@ -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()
|
||||
```
|
||||
Loading…
x
Reference in New Issue
Block a user