2022-03-22 14:15:39 +01:00
|
|
|
import logging
|
|
|
|
from pydbus import SystemBus
|
|
|
|
from gi.repository.GLib import GError
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
2022-05-31 13:39:20 +02:00
|
|
|
def signal_send(recipients, message):
|
2022-03-22 14:15:39 +01:00
|
|
|
try:
|
|
|
|
bus = SystemBus()
|
|
|
|
signal_bus = bus.get("org.asamk.Signal")
|
2022-10-31 13:27:01 +01:00
|
|
|
for recipient in recipients:
|
|
|
|
signal_bus.sendMessage(
|
|
|
|
message,
|
|
|
|
[],
|
|
|
|
recipient,
|
|
|
|
)
|
2022-03-22 14:15:39 +01:00
|
|
|
except GError as exn:
|
|
|
|
logger.error("Cannot send Signal notification: %s", exn)
|