Function: tramp-gvfs-parse-device-names

tramp-gvfs-parse-device-names is a byte-compiled function defined in tramp-gvfs.el.gz.

Signature

(tramp-gvfs-parse-device-names SERVICE)

Documentation

Return a list of (user host) tuples allowed to access.

This uses "avahi-browse" in case D-Bus is not enabled in Avahi.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-gvfs.el.gz
(defun tramp-gvfs-parse-device-names (service)
  "Return a list of (user host) tuples allowed to access.
This uses \"avahi-browse\" in case D-Bus is not enabled in Avahi."
  (let ((result
	 (ignore-errors
	   (split-string
	    (shell-command-to-string (format "avahi-browse -trkp %s" service))
	    (rx (+ (any "\r\n"))) 'omit (rx bol "+;" (* nonl) eol)))))
    (seq-uniq
     (tramp-compat-seq-keep
      (lambda (x)
	(ignore-errors
	  (let* ((list (split-string x ";"))
		 (host (nth 6 list))
		 (text (split-string (nth 9 list) "\" \"" 'omit "\""))
		 user)
	    ;; A user is marked in a TXT field like "u=guest".
	    (while text
	      (when (string-match (rx "u=" (group (+ nonl)) eol) (car text))
		(setq user (match-string 1 (car text))))
	      (setq text (cdr text)))
	    (list user host))))
      result))))