diff options
| author | Stefan Monnier | 2004-04-12 20:42:44 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-04-12 20:42:44 +0000 |
| commit | 76827ca49308a7e885481f3d5f875b5f10587b19 (patch) | |
| tree | 4ad3fb7550948173b8998fc431590d859f80a171 | |
| parent | 1e88a355b5b1cfd61f86e60e3ae1db60253d98fb (diff) | |
| download | emacs-76827ca49308a7e885481f3d5f875b5f10587b19.tar.gz emacs-76827ca49308a7e885481f3d5f875b5f10587b19.zip | |
Comments and docstring fixups.
| -rw-r--r-- | lisp/url/url-dav.el | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el index a35cb2a2bc6..b54d9f52c01 100644 --- a/lisp/url/url-dav.el +++ b/lisp/url/url-dav.el | |||
| @@ -1,11 +1,13 @@ | |||
| 1 | ;;; url-dav.el --- WebDAV support | 1 | ;;; url-dav.el --- WebDAV support |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 2001, 2004 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Bill Perry <wmperry@gnu.org> | 5 | ;; Author: Bill Perry <wmperry@gnu.org> |
| 6 | ;; Maintainer: Bill Perry <wmperry@gnu.org> | 6 | ;; Maintainer: Bill Perry <wmperry@gnu.org> |
| 7 | ;; Keywords: url, vc | 7 | ;; Keywords: url, vc |
| 8 | 8 | ||
| 9 | ;; This file is part of GNU Emacs. | ||
| 10 | |||
| 9 | ;; GNU Emacs is free software; you can redistribute it and/or modify | 11 | ;; GNU Emacs is free software; you can redistribute it and/or modify |
| 10 | ;; it under the terms of the GNU General Public License as published by | 12 | ;; it under the terms of the GNU General Public License as published by |
| 11 | ;; the Free Software Foundation; either version 2, or (at your option) | 13 | ;; the Free Software Foundation; either version 2, or (at your option) |
| @@ -23,6 +25,10 @@ | |||
| 23 | 25 | ||
| 24 | ;; DAV is in RFC 2518. | 26 | ;; DAV is in RFC 2518. |
| 25 | 27 | ||
| 28 | ;;; Commentary: | ||
| 29 | |||
| 30 | ;;; Code: | ||
| 31 | |||
| 26 | (eval-when-compile | 32 | (eval-when-compile |
| 27 | (require 'cl)) | 33 | (require 'cl)) |
| 28 | 34 | ||
| @@ -60,10 +66,10 @@ | |||
| 60 | 66 | ||
| 61 | 67 | ||
| 62 | ;;; Parsing routines for the actual node contents. | 68 | ;;; Parsing routines for the actual node contents. |
| 63 | ;;; | 69 | ;; |
| 64 | ;;; I am not incredibly happy with how this code looks/works right | 70 | ;; I am not incredibly happy with how this code looks/works right |
| 65 | ;;; now, but it DOES work, and if we get the API right, our callers | 71 | ;; now, but it DOES work, and if we get the API right, our callers |
| 66 | ;;; won't have to worry about the internal representation. | 72 | ;; won't have to worry about the internal representation. |
| 67 | 73 | ||
| 68 | (defconst url-dav-datatype-attribute | 74 | (defconst url-dav-datatype-attribute |
| 69 | 'urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/dt) | 75 | 'urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/dt) |
| @@ -99,8 +105,7 @@ | |||
| 99 | "List of regular expressions matching iso8601 dates. | 105 | "List of regular expressions matching iso8601 dates. |
| 100 | 1st regular expression matches the date. | 106 | 1st regular expression matches the date. |
| 101 | 2nd regular expression matches the time. | 107 | 2nd regular expression matches the time. |
| 102 | 3rd regular expression matches the (optional) timezone specification. | 108 | 3rd regular expression matches the (optional) timezone specification.") |
| 103 | ") | ||
| 104 | 109 | ||
| 105 | (defun url-dav-process-date-property (node) | 110 | (defun url-dav-process-date-property (node) |
| 106 | (require 'parse-time) | 111 | (require 'parse-time) |
| @@ -370,11 +375,10 @@ | |||
| 370 | 375 | ||
| 371 | ;;; DAV request/response generation/processing | 376 | ;;; DAV request/response generation/processing |
| 372 | (defun url-dav-process-response (buffer url) | 377 | (defun url-dav-process-response (buffer url) |
| 373 | "Parses a WebDAV response from BUFFER, interpreting it relative to URL. | 378 | "Parse a WebDAV response from BUFFER, interpreting it relative to URL. |
| 374 | 379 | ||
| 375 | The buffer must have been retrieved by HTTP or HTTPS and contain an | 380 | The buffer must have been retrieved by HTTP or HTTPS and contain an |
| 376 | XML document. | 381 | XML document." |
| 377 | " | ||
| 378 | (declare (special url-http-content-type | 382 | (declare (special url-http-content-type |
| 379 | url-http-response-status | 383 | url-http-response-status |
| 380 | url-http-end-of-headers)) | 384 | url-http-end-of-headers)) |
| @@ -412,7 +416,7 @@ XML document. | |||
| 412 | 416 | ||
| 413 | (defun url-dav-request (url method tag body | 417 | (defun url-dav-request (url method tag body |
| 414 | &optional depth headers namespaces) | 418 | &optional depth headers namespaces) |
| 415 | "Performs WebDAV operation METHOD on URL. Returns the parsed responses. | 419 | "Perform WebDAV operation METHOD on URL. Return the parsed responses. |
| 416 | Automatically creates an XML request body if TAG is non-nil. | 420 | Automatically creates an XML request body if TAG is non-nil. |
| 417 | BODY is the XML document fragment to be enclosed by <TAG></TAG>. | 421 | BODY is the XML document fragment to be enclosed by <TAG></TAG>. |
| 418 | 422 | ||
| @@ -425,8 +429,7 @@ HEADERS is an assoc list of extra headers to send in the request. | |||
| 425 | 429 | ||
| 426 | NAMESPACES is an assoc list of (NAMESPACE . EXPANSION), and these are | 430 | NAMESPACES is an assoc list of (NAMESPACE . EXPANSION), and these are |
| 427 | added to the <TAG> element. The DAV=DAV: namespace is automatically | 431 | added to the <TAG> element. The DAV=DAV: namespace is automatically |
| 428 | added to this list, so most requests can just pass in nil. | 432 | added to this list, so most requests can just pass in nil." |
| 429 | " | ||
| 430 | ;; Take care of the default value for depth... | 433 | ;; Take care of the default value for depth... |
| 431 | (setq depth (or depth 0)) | 434 | (setq depth (or depth 0)) |
| 432 | 435 | ||
| @@ -461,8 +464,7 @@ added to this list, so most requests can just pass in nil. | |||
| 461 | 464 | ||
| 462 | Returns an assoc list, where the key is the filename (possibly a full | 465 | Returns an assoc list, where the key is the filename (possibly a full |
| 463 | URI), and the value is a standard property list of DAV property | 466 | URI), and the value is a standard property list of DAV property |
| 464 | names (ie: DAV:resourcetype). | 467 | names (ie: DAV:resourcetype)." |
| 465 | " | ||
| 466 | (url-dav-request url "PROPFIND" 'DAV:propfind | 468 | (url-dav-request url "PROPFIND" 'DAV:propfind |
| 467 | (if attributes | 469 | (if attributes |
| 468 | (mapconcat (lambda (attr) | 470 | (mapconcat (lambda (attr) |
| @@ -484,8 +486,7 @@ names (ie: DAV:resourcetype). | |||
| 484 | This will be used as the contents of the DAV:owner/DAV:href tag to | 486 | This will be used as the contents of the DAV:owner/DAV:href tag to |
| 485 | identify the owner of a LOCK when requesting it. This will be shown | 487 | identify the owner of a LOCK when requesting it. This will be shown |
| 486 | to other users when the DAV:lockdiscovery property is requested, so | 488 | to other users when the DAV:lockdiscovery property is requested, so |
| 487 | make sure you are comfortable with it leaking to the outside world. | 489 | make sure you are comfortable with it leaking to the outside world.") |
| 488 | ") | ||
| 489 | 490 | ||
| 490 | ;;;###autoload | 491 | ;;;###autoload |
| 491 | (defun url-dav-lock-resource (url exclusive &optional depth) | 492 | (defun url-dav-lock-resource (url exclusive &optional depth) |
| @@ -495,8 +496,7 @@ Optional 3rd argument DEPTH says how deep the lock should go, default is 0 | |||
| 495 | 496 | ||
| 496 | Returns a cons-cell of (SUCCESSFUL-RESULTS . FAILURE-RESULTS). | 497 | Returns a cons-cell of (SUCCESSFUL-RESULTS . FAILURE-RESULTS). |
| 497 | SUCCESSFUL-RESULTS is a list of (URL STATUS locktoken). | 498 | SUCCESSFUL-RESULTS is a list of (URL STATUS locktoken). |
| 498 | FAILURE-RESULTS is a list of (URL STATUS). | 499 | FAILURE-RESULTS is a list of (URL STATUS)." |
| 499 | " | ||
| 500 | (setq exclusive (if exclusive "<DAV:exclusive/>" "<DAV:shared/>")) | 500 | (setq exclusive (if exclusive "<DAV:exclusive/>" "<DAV:shared/>")) |
| 501 | (let* ((body | 501 | (let* ((body |
| 502 | (concat | 502 | (concat |
| @@ -567,8 +567,7 @@ FAILURE-RESULTS is a list of (URL STATUS). | |||
| 567 | ;;;###autoload | 567 | ;;;###autoload |
| 568 | (defun url-dav-unlock-resource (url lock-token) | 568 | (defun url-dav-unlock-resource (url lock-token) |
| 569 | "Release the lock on URL represented by LOCK-TOKEN. | 569 | "Release the lock on URL represented by LOCK-TOKEN. |
| 570 | Returns `t' iff the lock was successfully released. | 570 | Returns t iff the lock was successfully released." |
| 571 | " | ||
| 572 | (declare (special url-http-response-status)) | 571 | (declare (special url-http-response-status)) |
| 573 | (let* ((url-request-extra-headers (list (cons "Lock-Token" | 572 | (let* ((url-request-extra-headers (list (cons "Lock-Token" |
| 574 | (concat "<" lock-token ">")))) | 573 | (concat "<" lock-token ">")))) |
| @@ -745,8 +744,7 @@ Use with care, and even then think three times. | |||
| 745 | (defun url-dav-delete-directory (url &optional recursive lock-token) | 744 | (defun url-dav-delete-directory (url &optional recursive lock-token) |
| 746 | "Delete the WebDAV collection URL. | 745 | "Delete the WebDAV collection URL. |
| 747 | If optional second argument RECURSIVE is non-nil, then delete all | 746 | If optional second argument RECURSIVE is non-nil, then delete all |
| 748 | files in the collection as well. | 747 | files in the collection as well." |
| 749 | " | ||
| 750 | (let ((status nil) | 748 | (let ((status nil) |
| 751 | (props nil) | 749 | (props nil) |
| 752 | (props nil)) | 750 | (props nil)) |
| @@ -795,8 +793,7 @@ If FULL is non-nil, return absolute file names. Otherwise return names | |||
| 795 | that are relative to the specified directory. | 793 | that are relative to the specified directory. |
| 796 | If MATCH is non-nil, mention only file names that match the regexp MATCH. | 794 | If MATCH is non-nil, mention only file names that match the regexp MATCH. |
| 797 | If NOSORT is non-nil, the list is not sorted--its order is unpredictable. | 795 | If NOSORT is non-nil, the list is not sorted--its order is unpredictable. |
| 798 | NOSORT is useful if you plan to sort the result yourself. | 796 | NOSORT is useful if you plan to sort the result yourself." |
| 799 | " | ||
| 800 | (let ((properties (url-dav-get-properties url '(DAV:resourcetype) 1)) | 797 | (let ((properties (url-dav-get-properties url '(DAV:resourcetype) 1)) |
| 801 | (child-url nil) | 798 | (child-url nil) |
| 802 | (child-props nil) | 799 | (child-props nil) |
| @@ -916,8 +913,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable. | |||
| 916 | ;;;###autoload | 913 | ;;;###autoload |
| 917 | (defun url-dav-file-name-all-completions (file url) | 914 | (defun url-dav-file-name-all-completions (file url) |
| 918 | "Return a list of all completions of file name FILE in directory DIRECTORY. | 915 | "Return a list of all completions of file name FILE in directory DIRECTORY. |
| 919 | These are all file names in directory DIRECTORY which begin with FILE. | 916 | These are all file names in directory DIRECTORY which begin with FILE." |
| 920 | " | ||
| 921 | (url-dav-directory-files url nil (concat "^" file ".*"))) | 917 | (url-dav-directory-files url nil (concat "^" file ".*"))) |
| 922 | 918 | ||
| 923 | ;;;###autoload | 919 | ;;;###autoload |
| @@ -926,8 +922,7 @@ These are all file names in directory DIRECTORY which begin with FILE. | |||
| 926 | Returns the longest string | 922 | Returns the longest string |
| 927 | common to all file names in DIRECTORY that start with FILE. | 923 | common to all file names in DIRECTORY that start with FILE. |
| 928 | If there is only one and FILE matches it exactly, returns t. | 924 | If there is only one and FILE matches it exactly, returns t. |
| 929 | Returns nil if DIR contains no name starting with FILE. | 925 | Returns nil if DIR contains no name starting with FILE." |
| 930 | " | ||
| 931 | (let ((matches (url-dav-file-name-all-completions file url)) | 926 | (let ((matches (url-dav-file-name-all-completions file url)) |
| 932 | (result nil)) | 927 | (result nil)) |
| 933 | (cond | 928 | (cond |
| @@ -989,4 +984,5 @@ Returns nil if DIR contains no name starting with FILE. | |||
| 989 | 984 | ||
| 990 | (provide 'url-dav) | 985 | (provide 'url-dav) |
| 991 | 986 | ||
| 992 | ;;; arch-tag: 2b14b7b3-888a-49b8-a490-17276a40e78e | 987 | ;; arch-tag: 2b14b7b3-888a-49b8-a490-17276a40e78e |
| 988 | ;;; url-dav.el ends here | ||