|
From: | AmarOk |
Subject: | [Ring] A simple ring/irc bridge (communicate with ring through dbus) |
Date: | Wed, 10 May 2017 23:36:30 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 |
Hi, Just a quick mail because someone said I should send this. So last Friday, I created a little bot[^1] to forward message between Ring.cx and IRC in Python which use dbus.
You can find this class in
`daemon/tools/dringctrl/` (controler.py). The controler is not
connected to all signals onIncomingAccountMessage`),
but you just have to connect a signal to a callback you want(or rewrite controler.py in the language you want). For example, in controler.py I just add: `proxy_confmgr.connect_to_signal('incomingAccountMessage', self.onIncomingAccountMessage)` and now, I can write something like: ```python
class IRCRingController(DRingCtrl): def __init__(self, config_bridge): super().__init__('ircbridge', True) def onIncomingAccountMessage(self, accountId, fromAccount, payloads): message = '%s: %s' % (fromAccount, payloads['text/plain']) print('Receive new message from %s' % message)
``` You can find all methods/signals in `daemon/
[^1]: https://blog.savoirfairelinux.com/en-ca/2015/internet-things-ring-connected-devices-iot/ [^2]:
|
signature.asc
Description: OpenPGP digital signature
[Prev in Thread] | Current Thread | [Next in Thread] |