signal-cli icon indicating copy to clipboard operation
signal-cli copied to clipboard

Event over Dbus when Device gets linked

Open bublath opened this issue 3 years ago • 3 comments

When I'm linking a device (scanning the QR Code) via Dbus, I currently see no way for the client to know this has happened. IMHO the DbusSignalControl would need a Dbus Signal that notifies the client a link has happened and which number to use. Is this possible?

bublath avatar Jan 17 '22 08:01 bublath

Should be possible, there's even a standard dbus signal that can be used to notify about newly exported objects: org.freedesktop.DBus.ObjectManager.InterfacesAdded In the latest signal-cli version there are also two new methods for linking startLink and finishLink that might help you. The startLink method returns the url for the qr code and the finishLink method returns the new account number.

AsamK avatar Jan 17 '22 15:01 AsamK

I tried this, but somehow fail to receive that message. As dry-run I just did a dbus-monitor --system "type='signal',interface='org.freedesktop.DBus.ObjectManager.InterfacesAdded'" I would expect this to trigger signals when restarting signal-cli daemon, but there was nothing. Is this not working on system bus?

startLink/finishLink are not yet documented it seems. So do I get it right: startLink gives me the URI so I can display the QR Code and then I call finishLink and it would return once done (or timeout?). Since Perl is a single threaded environment, that won't work for me (I'd block the whole framework). Emitting a Dbus signal would be much better.

bublath avatar Jan 18 '22 20:01 bublath

Yes, exactly. The InterfacesAdded event needs to be implemented in signal-cli, unfortunately dbus-java doesn't provide it automatically ...

AsamK avatar Jan 18 '22 21:01 AsamK