Function: zeroconf-service-browser-handler

zeroconf-service-browser-handler is a byte-compiled function defined in zeroconf.el.gz.

Signature

(zeroconf-service-browser-handler &rest VAL)

Documentation

Registered service browser handler at the Avahi daemon.

Source Code

;; Defined in /usr/src/emacs/lisp/net/zeroconf.el.gz
(defun zeroconf-service-browser-handler (&rest val)
  "Registered service browser handler at the Avahi daemon."
  ;; Parameters: (interface protocol name type domain flags)
  (when zeroconf-debug
    (message "zeroconf-service-browser-handler: %s %S"
	     (dbus-event-member-name last-input-event) val))
  (let* ((name (zeroconf-service-name val))
	 (type (zeroconf-service-type val))
	 (key (concat name "/" type))
	 (ahook (gethash type zeroconf-service-added-hooks-hash nil))
	 (rhook (gethash type zeroconf-service-removed-hooks-hash nil)))
    (cond
     ((string-equal (dbus-event-member-name last-input-event) "ItemNew")
      ;; Add new service.
      (puthash key val zeroconf-services-hash)
      (dolist (f ahook) (funcall f val)))

     ((string-equal (dbus-event-member-name last-input-event) "ItemRemove")
      ;; Remove the service.
      (remhash key zeroconf-services-hash)
      (remhash key zeroconf-resolved-services-hash)
      (dolist (f rhook) (funcall f val))))))