Function: url-dav-file-attributes-mode-string

url-dav-file-attributes-mode-string is a byte-compiled function defined in url-dav.el.gz.

Signature

(url-dav-file-attributes-mode-string PROPERTIES)

Source Code

;; Defined in /usr/src/emacs/lisp/url/url-dav.el.gz
;;; file-name-handler stuff
(defun url-dav-file-attributes-mode-string (properties)
  (let ((modes (make-string 10 ?-))
	(supported-locks (plist-get properties 'DAV:supportedlock))
	(executable-p (equal (plist-get properties 'http://apache.org/dav/props/executable)
			     "T"))
	(directory-p (memq 'DAV:collection (plist-get properties 'DAV:resourcetype)))
	(readable t)
	(lock nil))
    ;; Assume we can read this, otherwise the PROPFIND would have
    ;; failed.
    (when readable
      (aset modes 1 ?r)
      (aset modes 4 ?r)
      (aset modes 7 ?r))

    (when directory-p
      (aset modes 0 ?d))

    (when executable-p
      (aset modes 3 ?x)
      (aset modes 6 ?x)
      (aset modes 9 ?x))

    (while supported-locks
      (setq lock (car supported-locks)
	    supported-locks (cdr supported-locks))
      (pcase (car lock)
	('DAV:write
	 (pcase (cdr lock)
	   ('DAV:shared			; group permissions (possibly world)
	    (aset modes 5 ?w))
	   ('DAV:exclusive
	    (aset modes 2 ?w))		; owner permissions?
	   (_
	    (url-debug 'dav "Unrecognized DAV:lockscope (%S)" (cdr lock)))))
	(_
	 (url-debug 'dav "Unrecognized DAV:locktype (%S)" (car lock)))))
    modes))