From b39eecb3c7e7c9120b5107797fbe66cc4bf78bd4 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 4 Jul 2014 12:03:14 +0200 Subject: [PATCH] Fix Bug#17858 * net/dbus.el (dbus-peer-handler): New defun. (dbus-register-service): Register it. (dbus-managed-objects-handler): Fix docstring. --- lisp/ChangeLog | 10 ++++++++-- lisp/net/dbus.el | 22 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ed9a1100d49..5c91db50037 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2014-07-04 Michael Albinus + + * net/dbus.el (dbus-peer-handler): New defun. + (dbus-register-service): Register it. (Bug#17858) + (dbus-managed-objects-handler): Fix docstring. + 2014-07-04 Phil Sainty (tiny change) * emacs-lisp/lisp.el (narrow-to-defun-include-comments): New var. @@ -1762,7 +1768,7 @@ Remove HISTFILE and HISTSIZE; it's too late to set them here. Add :version entry. (tramp-open-shell): Do not let-bind `tramp-end-of-output'. - Add "HISTSIZE=/dev/null" to the shell's env arguments. Do not send + Add "HISTFILE=/dev/null" to the shell's env arguments. Do not send extra "PSx=..." commands. (tramp-maybe-open-connection): Setenv HISTFILE to /dev/null. (Bug#17295) @@ -3462,7 +3468,7 @@ 2014-03-10 Michael Albinus * net/tramp-sh.el (tramp-open-connection-setup-interactive-shell): - Do not add `nil' to the environment, when there's no remote `locale'. + Do not add nil to the environment, when there's no remote `locale'. (tramp-find-inline-encoding): Check, that the remote host has installed perl, before sending scripts. diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el index 66170dafef8..582f54faf4e 100644 --- a/lisp/net/dbus.el +++ b/lisp/net/dbus.el @@ -544,6 +544,10 @@ placed in the queue. `:already-owner': Service is already the primary owner." + ;; Add Peer handler. + (dbus-register-method + bus service nil dbus-interface-peer "Ping" 'dbus-peer-handler 'dont-register) + ;; Add ObjectManager handler. (dbus-register-method bus service nil dbus-interface-objectmanager "GetManagedObjects" @@ -1151,6 +1155,22 @@ apply bus service dbus-path-dbus dbus-interface-peer "Ping"))) (dbus-error nil))) +(defun dbus-peer-handler () + "Default handler for the \"org.freedesktop.DBus.Peer\" interface. +It will be registered for all objects created by `dbus-register-service'." + (let* ((last-input-event last-input-event) + (method (dbus-event-member-name last-input-event))) + (cond + ;; "Ping" does not return an output parameter. + ((string-equal method "Ping") + :ignore) + ;; "GetMachineId" returns "s". + ((string-equal method "GetMachineId") + (signal + 'dbus-error + (list + (format "%s.GetMachineId not implemented" dbus-interface-peer))))))) + ;;; D-Bus introspection. @@ -1672,7 +1692,7 @@ and \"org.freedesktop.DBus.Properties.GetAll\", which is slow." (defun dbus-managed-objects-handler () "Default handler for the \"org.freedesktop.DBus.ObjectManager\" interface. -It will be registered for all objects created by `dbus-register-method'." +It will be registered for all objects created by `dbus-register-service'." (let* ((last-input-event last-input-event) (bus (dbus-event-bus-name last-input-event)) (path (dbus-event-path-name last-input-event))) -- 2.39.5