Function: url-dav-active-locks

url-dav-active-locks is a byte-compiled function defined in url-dav.el.gz.

Signature

(url-dav-active-locks URL &optional DEPTH)

Documentation

Return an assoc list of all active locks on URL.

Source Code

;; Defined in /usr/src/emacs/lisp/url/url-dav.el.gz
(defun url-dav-active-locks (url &optional depth)
  "Return an assoc list of all active locks on URL."
  (let ((response (url-dav-get-properties url '(DAV:lockdiscovery) depth))
	;; (properties nil)
	(child nil)
	(child-url nil)
	(child-results nil)
	(results nil))
    (if (not (url-p url))
	(setq url (url-generic-parse-url url)))

    (while response
      (setq child (pop response)
	    child-url (pop child)
	    child-results nil)
      (when (and (url-dav-http-success-p (plist-get child 'DAV:status))
		 (setq child (plist-get child 'DAV:lockdiscovery)))
	;; After our parser has had its way with it, The
	;; DAV:lockdiscovery property is a list of DAV:activelock
	;; objects, which are comprised of DAV:activelocks, which
	;; assoc lists of properties and values.
	(while child
	  (if (assq 'DAV:locktoken (car child))
	      (let ((tokens (cdr (assq 'DAV:locktoken (car child))))
		    (owners (cdr (assq 'DAV:owner (car child)))))
		(dolist (token tokens)
		  (dolist (owner owners)
		    (push (cons token owner) child-results)))))
	  (pop child)))
      (if child-results
	  (push (cons (url-expand-file-name child-url url) child-results)
		results)))
    results))