[Top][All Lists]

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

Re: DBus methods without name grabbing

From: Michael Albinus
Subject: Re: DBus methods without name grabbing
Date: Mon, 03 Jan 2011 13:55:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Jan Moringen <address@hidden> writes:

> Hi,

Hi Jan,

> recently I ran into the following DBus-related problem: In order to
> write a telepathy client [1], it is required to provide a certain
> DBus-Interface under a special well-known name. Some telepathy component
> seems to start calling methods immediately after the well-known name is
> taken. Since the interface consists of multiple methods/properties, it
> cannot be ensured that the interface is completely available when the
> name is taken and the first calls are made using Emacs' current
> DBus-interface. This is due to the fact that the function
> `dbus-register-method' immediately takes the name.

In general, I agree with your proposal. I have some few comments:

- The optional parameter in `dbus-register-method' and
  `dbus-register-property' shall be called `dont-register-service'. This
  would fit the dbus terminology we use so far.

- We might introduce a new function `dbus-register-service' (in dbusbind.c).
  It could offer optional argument flags, a list of the supported flags
  of "org.freedesktop.DBus.RequestName"
  DBUS_NAME_FLAG_DO_NOT_QUEUE). This function shall be called in
  `dbus-register-method' and `dbus-register-property' when
  `dont-register-service' is nil. Btw, the function
  `dbus-unregister-service' exists already ...

- It would be great, if you could add also changed doc strings, changed
  dbus.texi, ChangeLog and etc/NEWS entries.

> To allow Emacs to work with this kind of DBus-interfaces, I suggest the
> changes implemented in the attached patch. I don't known the Emacs C
> code well very well, so it probably needs revision.
> === modified file 'src/dbusbind.c'
> --- src/dbusbind.c    2010-10-01 13:56:33 +0000
> +++ src/dbusbind.c    2010-10-03 02:17:34 +0000
> @@ -1983,10 +1983,16 @@
>    /* Request the known name from the bus.  We can ignore the result,
>       it is set to -1 if there is an error - kind of redundancy.  */
> -  dbus_error_init (&derror);
> -  result = dbus_bus_request_name (connection, SDATA (service), 0, &derror);
> -  if (dbus_error_is_set (&derror))
> -    XD_ERROR (derror);
> +  if (!dont_request_name || NILP (dont_request_name))

dont_request_name is a Lisp object, it is nil when not used in the
call. You shall use

if (NILP (dont_request_name))

Best regards, Michael.

reply via email to

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