[Telepathy] "This connection has no unique name yet"

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Jun 5 04:04:46 PDT 2009


On Thu, 04 Jun 2009 at 17:48:23 -0400, Benjamin M. Schwartz wrote:
> Often when I'm sending broadcast signals on a D-Bus Tube, I want to
> respond only if the signal was not sent by myself.  To this end, it would
> be convenient to cache my own "sender" identity.  I have tried to do so
> using get_unique_name(), but if I call it too early I get
> 
> DbusException: This connection has no unique name yet

In Tubes it's best to get this information out-of-band by making calls on the
Tubes or DBusTube channel. The Sugar TubeConnection class pushes that
information into the tube's D-Bus connection before it starts sending messages.

In the old Tubes channel type, use the GetDBusNames method and the
DBusNamesChanged signal on the Tubes channel. I believe the TubeConnection
class we wrote for Sugar wraps these in a vaguely convenient way. The method
returns a list of tuples, [(contact handle, unique name), ...].

In the new DBusTube channel type (one channel per tube), use the D-Bus
Properties Get method to get the DBusNames property, and listen for the
DBusNamesChanged signal. This time the method returns a dict,
{ contact handle: unique name, ... }.

In either case, if the channel has the Group interface, look for the
SelfHandle from the Group interface in the D-Bus names (which may be a
chatroom-specific handle, e.g. on XMPP), and if it doesn't, look for the
SelfHandle from the Connection.

    Simon


More information about the telepathy mailing list