jami
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ring] A simple ring/irc bridge (communicate with ring through dbus)


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.
It's a little bot which can send you the content of an IRC channel to your Ring account

(you just have to send !follow/!unfollow) and send a message to a specific account with

"!tell nick message".

In fact, it's pretty easy to communicate with ring daemon. In this article[^2], we can see the class `DRingCtrl`.

You can find this class in `daemon/tools/dringctrl/` (controler.py). The controler is not connected to all signals
yet (i.e. you can't use `
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/bin/dbus/cx.ring.Ring.*.xml`

Finally, I wrote something in French here: https://zestedesavoir.com/contenus/1829/creer-un-bridge-irc-ring/

[^1]: https://blog.savoirfairelinux.com/en-ca/2015/internet-things-ring-connected-devices-iot/

[^2]: So, you can find my little script here https://gist.github.com/AmarOk1412/df88402e9a1e5710898cd2df2be117d8

Have a nice day,

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]