From: hmurata Date: Thu, 20 Sep 2001 15:46:06 +0000 (+0000) Subject: * elmo.el (elmo-folder-writable-p): Changed default value to nil. X-Git-Tag: wl-2_7_5~57 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=366496cfdf25d8df2f76be499708b5f3d222718e;p=elisp%2Fwanderlust.git * elmo.el (elmo-folder-writable-p): Changed default value to nil. (elmo-folder-move-messages): Check `elmo-folder-writable-p'. * elmo-archive.el (elmo-folder-writable-p): Defined. * elmo-cache.el (elmo-folder-writable-p): Ditto. * elmo-filter.el (elmo-folder-writable-p): Ditto. * elmo-imap4.el (elmo-folder-writable-p): Ditto. * elmo-localdir.el (elmo-folder-writable-p): Ditto. * elmo-maildir.el (elmo-folder-writable-p): Ditto. * elmo-mark.el (elmo-folder-writable-p): Ditto. * elmo-pipe.el (elmo-folder-writable-p): Ditto. * elmo-nntp.el (elmo-folder-writable-p): Eliminated. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index db107b6..06c4c5f 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,26 @@ +2001-09-20 Hiroya Murata + + * elmo.el (elmo-folder-writable-p): Changed default value to nil. + (elmo-folder-move-messages): Check `elmo-folder-writable-p'. + + * elmo-archive.el (elmo-folder-writable-p): Defined. + + * elmo-cache.el (elmo-folder-writable-p): Ditto. + + * elmo-filter.el (elmo-folder-writable-p): Ditto. + + * elmo-imap4.el (elmo-folder-writable-p): Ditto. + + * elmo-localdir.el (elmo-folder-writable-p): Ditto. + + * elmo-maildir.el (elmo-folder-writable-p): Ditto. + + * elmo-mark.el (elmo-folder-writable-p): Ditto. + + * elmo-pipe.el (elmo-folder-writable-p): Ditto. + + * elmo-nntp.el (elmo-folder-writable-p): Eliminated. + 2001-09-20 Yuuichi Teranishi * elmo-util.el (elmo-address-quote-specials): New function; diff --git a/elmo/elmo-archive.el b/elmo/elmo-archive.el index 16ddc78..cd62a39 100644 --- a/elmo/elmo-archive.el +++ b/elmo/elmo-archive.el @@ -27,12 +27,12 @@ ;; ;;; Commentary: -;; +;; ;; TODO: ;; Info-Zip ÀìÍÑ¥¨¡¼¥¸¥§¥ó¥È¤òÍѤ¤¤¿ÆüËܸ측º÷¡ÊOS/2 ÀìÍÑ¡Ë¡£ ;;; Code: -;; +;; (require 'elmo-msgdb) (require 'emu) @@ -283,7 +283,7 @@ TYPE specifies the archiver's symbol." (let* ((type (elmo-archive-folder-archive-type-internal folder)) (prefix (elmo-archive-folder-archive-prefix-internal folder)) - (file (elmo-archive-get-archive-name folder)) + (file (elmo-archive-get-archive-name folder)) (method (elmo-archive-get-method type 'ls)) (args (list file)) (file-regexp (format (elmo-archive-get-regexp type) @@ -340,7 +340,7 @@ TYPE specifies the archiver's symbol." (defun elmo-archive-get-archive-name (folder) (let ((dir (elmo-archive-get-archive-directory folder)) - (suffix (elmo-archive-get-suffix + (suffix (elmo-archive-get-suffix (elmo-archive-folder-archive-type-internal folder))) filename dbdir) @@ -393,22 +393,25 @@ TYPE specifies the archiver's symbol." (luna-define-method elmo-folder-creatable-p ((folder elmo-archive-folder)) t) +(luna-define-method elmo-folder-writable-p ((folder elmo-archive-folder)) + t) + (luna-define-method elmo-folder-create ((folder elmo-archive-folder)) (let* ((dir (directory-file-name ; remove tail slash. (elmo-archive-get-archive-directory folder))) - (type (elmo-archive-folder-archive-type-internal folder)) - (arc (elmo-archive-get-archive-name folder))) + (type (elmo-archive-folder-archive-type-internal folder)) + (arc (elmo-archive-get-archive-name folder))) (if elmo-archive-treat-file (setq dir (directory-file-name (file-name-directory dir)))) (cond ((and (file-exists-p dir) (not (file-directory-p dir))) - ;; file exists - (error "Create folder failed; File \"%s\" exists" dir)) - ((file-directory-p dir) - (if (file-exists-p arc) - t ; return value + ;; file exists + (error "Create folder failed; File \"%s\" exists" dir)) + ((file-directory-p dir) + (if (file-exists-p arc) + t ; return value (elmo-archive-create-file arc type folder))) - (t + (t (elmo-make-directory dir) (elmo-archive-create-file arc type folder) t)))) @@ -417,8 +420,8 @@ TYPE specifies the archiver's symbol." (save-excursion (let* ((tmp-dir (directory-file-name (elmo-folder-msgdb-path folder))) - (dummy elmo-archive-dummy-file) - (method (or (elmo-archive-get-method type 'create) + (dummy elmo-archive-dummy-file) + (method (or (elmo-archive-get-method type 'create) (elmo-archive-get-method type 'mv))) (args (list archive dummy))) (when (null method) @@ -476,7 +479,7 @@ TYPE specifies the archiver's symbol." (prefix (if (string= (elmo-archive-folder-archive-prefix-internal folder) "") - "" + "" (concat ";" (elmo-archive-folder-archive-prefix-internal folder)))) @@ -596,7 +599,7 @@ TYPE specifies the archiver's symbol." (elmo-folder-message-file-p src-folder) (elmo-folder-message-file-number-p src-folder)) ;; same-number(localdir, localnews) -> archive - (elmo-archive-append-files folder + (elmo-archive-append-files folder (elmo-folder-message-file-directory src-folder) numbers) numbers) @@ -616,7 +619,7 @@ TYPE specifies the archiver's symbol." (elmo-make-directory (file-name-directory prefix))) (rename-file temp-dir - (setq new-dir + (setq new-dir (expand-file-name prefix ;; parent of temp-dir..(works in windows?) @@ -642,7 +645,7 @@ TYPE specifies the archiver's symbol." (or (elmo-archive-get-method type 'ext-pipe) (elmo-archive-get-method type 'ext)))) -(luna-define-method elmo-folder-message-make-temp-files +(luna-define-method elmo-folder-message-make-temp-files ((folder elmo-archive-folder) numbers &optional start-number) (elmo-archive-folder-message-make-temp-files folder numbers start-number)) @@ -652,7 +655,7 @@ TYPE specifies the archiver's symbol." start-number) (let* ((tmp-dir-src (elmo-folder-make-temp-dir folder)) (tmp-dir-dst (elmo-folder-make-temp-dir folder)) - (arc (elmo-archive-get-archive-name folder)) + (arc (elmo-archive-get-archive-name folder)) (type (elmo-archive-folder-archive-type-internal folder)) (prefix (elmo-archive-folder-archive-prefix-internal folder)) (p-method (elmo-archive-get-method type 'ext-pipe)) @@ -662,7 +665,7 @@ TYPE specifies the archiver's symbol." (int-to-string x))) numbers)) number) ;; Expand files in the tmp-dir-src. - (elmo-bind-directory + (elmo-bind-directory tmp-dir-src (cond ((functionp n-method) @@ -694,7 +697,7 @@ TYPE specifies the archiver's symbol." (elmo-delete-directory tmp-dir-src) ;; tmp-dir-dst is the return directory. tmp-dir-dst)) - + (defun elmo-archive-append-files (folder dir &optional files) (let* ((dst-type (elmo-archive-folder-archive-type-internal folder)) (arc (elmo-archive-get-archive-name folder)) @@ -893,13 +896,13 @@ TYPE specifies the archiver's symbol." (elmo-archive-folder-archive-type-internal folder) 'cat-headers)) (elmo-archive-msgdb-create-as-numlist-subr2 - folder numbers new-mark already-mark seen-mark important-mark + folder numbers new-mark already-mark seen-mark important-mark seen-list) (elmo-archive-msgdb-create-as-numlist-subr1 - folder numbers new-mark already-mark seen-mark important-mark + folder numbers new-mark already-mark seen-mark important-mark seen-list))))) -(defun elmo-archive-msgdb-create-as-numlist-subr1 (folder +(defun elmo-archive-msgdb-create-as-numlist-subr1 (folder numlist new-mark already-mark seen-mark important-mark @@ -1025,16 +1028,16 @@ TYPE specifies the archiver's symbol." (goto-char (point-min)) (setq rest msgs) (while (and rest (re-search-forward delim nil t) - (not (eobp))) + (not (eobp))) (setq number (car rest)) (setq sp (1+ (point))) (setq ep (prog2 (re-search-forward delim) (1+ (- (point) (length delim))))) (if (>= sp ep) ; no article! () ; nop - (save-excursion - (narrow-to-region sp ep) - (setq entity (elmo-archive-msgdb-create-entity-subr number)) + (save-excursion + (narrow-to-region sp ep) + (setq entity (elmo-archive-msgdb-create-entity-subr number)) (setq overview (elmo-msgdb-append-element overview entity)) @@ -1060,7 +1063,7 @@ TYPE specifies the archiver's symbol." mark-alist (elmo-msgdb-overview-entity-get-number entity) gmark))) - (setq ret-val (append ret-val (list overview number-alist mark-alist))) + (setq ret-val (append ret-val (list overview number-alist mark-alist))) (widen))) (forward-line 1) (setq rest (cdr rest))) @@ -1098,7 +1101,7 @@ TYPE specifies the archiver's symbol." number-list ret-val) (setq number-list msgs) (while msgs - (if (elmo-archive-field-condition-match + (if (elmo-archive-field-condition-match folder (car msgs) number-list condition (elmo-archive-folder-archive-prefix-internal folder)) diff --git a/elmo/elmo-cache.el b/elmo/elmo-cache.el index a046d83..980a650 100644 --- a/elmo/elmo-cache.el +++ b/elmo/elmo-cache.el @@ -168,6 +168,9 @@ (luna-define-method elmo-folder-creatable-p ((folder elmo-cache-folder)) nil) +(luna-define-method elmo-folder-writable-p ((folder elmo-cache-folder)) + t) + (luna-define-method elmo-folder-exists-p ((folder elmo-cache-folder)) t) diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index ff4dc2b..5ce73ba 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -175,6 +175,9 @@ (luna-define-method elmo-folder-creatable-p ((folder elmo-filter-folder)) (elmo-folder-creatable-p (elmo-filter-folder-target-internal folder))) +(luna-define-method elmo-folder-writable-p ((folder elmo-filter-folder)) + (elmo-folder-writable-p (elmo-filter-folder-target-internal folder))) + (luna-define-method elmo-folder-create ((folder elmo-filter-folder)) (elmo-folder-create (elmo-filter-folder-target-internal folder))) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 30b2f7a..373726d 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -1878,12 +1878,12 @@ Return nil if no complete line has arrived." (setq append-serv (concat ":" (elmo-net-folder-user-internal folder)))) (unless (eq (elmo-net-folder-auth-internal folder) (or elmo-imap4-default-authenticate-type 'clear)) - (setq append-serv + (setq append-serv (concat append-serv "/" (symbol-name (elmo-net-folder-auth-internal folder))))) (unless (string= (elmo-net-folder-server-internal folder) elmo-imap4-default-server) - (setq append-serv (concat append-serv "@" + (setq append-serv (concat append-serv "@" (elmo-net-folder-server-internal folder)))) (unless (eq (elmo-net-folder-port-internal folder) elmo-imap4-default-port) (setq append-serv (concat append-serv ":" @@ -1899,23 +1899,23 @@ Return nil if no complete line has arrived." (if one-level (let (folder folders ret) (while (setq folders (car result)) - (if (prog1 + (if (prog1 (string-match (concat "^\\(" root "[^" delim "]" "+\\)" delim) folders) (setq folder (match-string 1 folders))) (progn - (setq ret - (append ret - (list + (setq ret + (append ret + (list (list - (concat + (concat prefix (elmo-imap4-decode-folder-string folder) (and append-serv (eval append-serv))))))) (setq result - (delq + (delq nil (mapcar '(lambda (fld) (unless @@ -1925,8 +1925,8 @@ Return nil if no complete line has arrived." fld)) result)))) (setq ret (append - ret - (list + ret + (list (concat prefix (elmo-imap4-decode-folder-string folders) (and append-serv @@ -1950,6 +1950,9 @@ Return nil if no complete line has arrived." (elmo-imap4-folder-mailbox-internal folder) 'force 'no-error)))) +(luna-define-method elmo-folder-writable-p ((folder elmo-imap4-folder)) + t) + (luna-define-method elmo-folder-delete ((folder elmo-imap4-folder)) (let ((session (elmo-imap4-get-session folder)) msgs) @@ -2139,7 +2142,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (elmo-imap4-search-internal folder session (nth 2 condition) from-msgs))) result (sort result '<)))))) - + (luna-define-method elmo-folder-search ((folder elmo-imap4-folder) condition &optional numbers) (save-excursion @@ -2221,7 +2224,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (not (elmo-imap4-session-read-only-internal (elmo-imap4-get-session folder))) elmo-enable-disconnected-operation)) ; offline refile. - + (luna-define-method elmo-folder-check-plugged ((folder elmo-imap4-folder)) (let ((session (elmo-imap4-get-session folder 'if-exists))) (when session @@ -2232,7 +2235,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (elmo-imap4-session-select-mailbox session (elmo-imap4-folder-mailbox-internal folder) - 'force) + 'force) (elmo-imap4-session-check session)))))) (defsubst elmo-imap4-folder-diff-plugged (folder) @@ -2295,7 +2298,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (elmo-imap4-session-set-current-mailbox-internal session mailbox) (and session - (elmo-imap4-session-set-current-mailbox-internal + (elmo-imap4-session-set-current-mailbox-internal session nil)))) (error (if response @@ -2463,7 +2466,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (luna-define-method elmo-message-fetch-plugged ((folder elmo-imap4-folder) number strategy - &optional section + &optional section outbuf unseen) (elmo-imap4-message-fetch folder number strategy section outbuf unseen)) @@ -2477,7 +2480,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (setq elmo-imap4-fetch-callback nil) (setq elmo-imap4-fetch-callback-data nil)) (with-temp-buffer - (insert + (insert (elmo-imap4-response-bodydetail-text (elmo-imap4-response-value (elmo-imap4-send-command-wait session @@ -2493,7 +2496,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (std11-field-body (symbol-name field))))) - + (require 'product) (product-provide (provide 'elmo-imap4) (require 'elmo-version)) diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index 1384a38..2c9c0df 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -28,10 +28,10 @@ ;; ;;; Commentary: -;; +;; ;;; Code: -;; +;; (eval-when-compile (require 'cl)) (require 'elmo-msgdb) @@ -283,6 +283,9 @@ (luna-define-method elmo-folder-creatable-p ((folder elmo-localdir-folder)) t) +(luna-define-method elmo-folder-writable-p ((folder elmo-localdir-folder)) + t) + (luna-define-method elmo-folder-create ((folder elmo-localdir-folder)) (let ((dir (elmo-localdir-folder-directory-internal folder))) (if (file-directory-p dir) diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index 4bd8a08..7e3bf1c 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -440,6 +440,9 @@ file name for maildir directories." (luna-define-method elmo-folder-creatable-p ((folder elmo-maildir-folder)) t) +(luna-define-method elmo-folder-writable-p ((folder elmo-maildir-folder)) + t) + (luna-define-method elmo-folder-create ((folder elmo-maildir-folder)) (let ((basedir (elmo-maildir-folder-directory-internal folder))) (condition-case nil diff --git a/elmo/elmo-mark.el b/elmo/elmo-mark.el index b531e83..cfa33ff 100644 --- a/elmo/elmo-mark.el +++ b/elmo/elmo-mark.el @@ -58,7 +58,7 @@ (expand-file-name "internal" elmo-msgdb-dir))) -(luna-define-method elmo-map-folder-list-message-locations +(luna-define-method elmo-map-folder-list-message-locations ((folder elmo-mark-folder)) (elmo-mark-folder-list-message-locations folder)) @@ -66,7 +66,7 @@ (let (result) (dolist (pair (or elmo-msgdb-global-mark-alist (setq elmo-msgdb-global-mark-alist - (elmo-object-load + (elmo-object-load (expand-file-name elmo-msgdb-global-mark-filename elmo-msgdb-dir))))) @@ -138,7 +138,7 @@ (when (file-writable-p path) (write-region-as-binary (point-min) (point-max) path nil 'no-msg))) - (elmo-msgdb-global-mark-set msgid + (elmo-msgdb-global-mark-set msgid (elmo-mark-folder-mark-internal folder)))) (luna-define-method elmo-map-folder-delete-messages ((folder elmo-mark-folder) @@ -161,6 +161,9 @@ (luna-define-method elmo-folder-exists-p ((folder elmo-mark-folder)) t) +(luna-define-method elmo-folder-writable-p ((folder elmo-mark-folder)) + t) + (luna-define-method elmo-folder-search ((folder elmo-mark-folder) condition &optional from-msgs) (let* ((msgs (or from-msgs (elmo-folder-list-messages folder))) diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index ff3e29d..e8be352 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -1423,9 +1423,6 @@ Returns a list of cons cells like (NUMBER . VALUE)" (luna-define-method elmo-folder-creatable-p ((folder elmo-nntp-folder)) nil) -(luna-define-method elmo-folder-writable-p ((folder elmo-nntp-folder)) - nil) - (defun elmo-nntp-parse-newsgroups (string &optional subscribe-only) (let ((nglist (elmo-parse string "[ \t\f\r\n,]*\\([^ \t\f\r\n,]+\\)")) ngs) diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index a64d4bd..6d562dd 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -159,6 +159,9 @@ (and (elmo-folder-creatable-p (elmo-pipe-folder-src-internal folder)) (elmo-folder-creatable-p (elmo-pipe-folder-dst-internal folder)))) +(luna-define-method elmo-folder-writable-p ((folder elmo-pipe-folder)) + (elmo-folder-writable-p (elmo-pipe-folder-dst-internal folder))) + (luna-define-method elmo-folder-create ((folder elmo-pipe-folder)) (if (and (not (elmo-folder-exists-p (elmo-pipe-folder-src-internal folder))) (elmo-folder-creatable-p (elmo-pipe-folder-src-internal folder))) diff --git a/elmo/elmo.el b/elmo/elmo.el index 0dbcf75..8f2d9c9 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -671,7 +671,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") t) ; default is creatable. (luna-define-method elmo-folder-writable-p ((folder elmo-folder)) - t) ; default is writable. + nil) ; default is not writable. (luna-define-method elmo-folder-rename ((folder elmo-folder) new-name) (let* ((new-folder (elmo-make-folder new-name))) @@ -917,8 +917,11 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") succeeds i result) (if (eq dst-folder 'null) (setq succeeds messages) - ;; src is already opened. + (unless (elmo-folder-writable-p dst-folder) + (error "move: %d is not writable" + (elmo-folder-name-internal dst-folder))) (when messages + ;; src is already opened. (elmo-folder-open-internal dst-folder) (unless (setq succeeds (elmo-folder-append-messages dst-folder src-folder @@ -948,7 +951,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (if (not no-delete-info) (message "Cleaning up src folder...")) (if (and (elmo-folder-delete-messages src-folder succeeds) - (elmo-msgdb-delete-msgs + (elmo-msgdb-delete-msgs (elmo-folder-msgdb src-folder) succeeds)) (setq result t) (message "move: delete messages from %s failed."