From: hmurata Date: Wed, 3 Apr 2002 13:14:07 +0000 (+0000) Subject: * elmo.el (elmo-folder-creatable-p): Changed default value to nil X-Git-Tag: elmo-mark-root~220 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ee2df2d9ba35b5961d631bee2d6133cf6c3746e;p=elisp%2Fwanderlust.git * elmo.el (elmo-folder-creatable-p): Changed default value to nil from t. * elmo-pop3.el (elmo-folder-exists-p): Return nil if unplugged. * elmo-nntp.el (elmo-folder-exists-p-plugged): Divided plugged case from `elmo-folder-exists-p'. (elmo-folder-exists-p): Removed. (elmo-folder-creatable-p) Ditto. * elmo-net.el (elmo-folder-create): Defined. (elmo-folder-create-unplugged): New function. (elmo-folder-exists-p): Changed default value to nil from t. * elmo-imap4.el (elmo-folder-creatable-p): Defined. (elmo-folder-create-plugged): Renamed from `elmo-folder-create'. * elmo-dop.el (elmo-folder-create-dop): Renamed from `elmo-create-folder-dop' and append queue 'elmo-folder-create-dop-delayed instead of 'elmo-folder-create. (elmo-folder-create-dop-delayed): New function. * elmo-cache.el (elmo-folder-creatable-p): Ditto. * elmo-shimbun.el (elmo-folder-creatable-p): Ditto. * elmo-sendlog.el (elmo-folder-creatable-p): Ditto. (elmo-folder-writable-p) : Ditto. * wl-summary.el (wl-summary-refile-subr): Cause an error if FOLDER is not writable. * wl-folder.el (wl-folder-create-subr): Cause an error if FOLDER is not creatable. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 8648dcc..fb72bcd 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,34 @@ 2002-04-03 Hiroya Murata + * elmo.el (elmo-folder-creatable-p): Changed default value to nil + from t. + + * elmo-pop3.el (elmo-folder-exists-p): Return nil if unplugged. + + * elmo-nntp.el (elmo-folder-exists-p-plugged): Divided plugged + case from `elmo-folder-exists-p'. + (elmo-folder-exists-p): Removed. + (elmo-folder-creatable-p) Ditto. + + * elmo-net.el (elmo-folder-create): Defined. + (elmo-folder-create-unplugged): New function. + (elmo-folder-exists-p): Changed default value to nil from t. + + * elmo-imap4.el (elmo-folder-creatable-p): Defined. + (elmo-folder-create-plugged): Renamed from `elmo-folder-create'. + + * elmo-dop.el (elmo-folder-create-dop): Renamed from + `elmo-create-folder-dop' and append queue + 'elmo-folder-create-dop-delayed instead of 'elmo-folder-create. + (elmo-folder-create-dop-delayed): New function. + + * elmo-cache.el (elmo-folder-creatable-p): Ditto. + + * elmo-shimbun.el (elmo-folder-creatable-p): Ditto. + + * elmo-sendlog.el (elmo-folder-creatable-p): Ditto. + (elmo-folder-writable-p) : Ditto. + * elmo-version.el (elmo-version): Up to 2.9.9. 2002-03-26 Yoichi NAKAYAMA diff --git a/elmo/elmo-cache.el b/elmo/elmo-cache.el index 08fe192..67d80b7 100644 --- a/elmo/elmo-cache.el +++ b/elmo/elmo-cache.el @@ -161,9 +161,6 @@ (when (file-exists-p file) (insert-file-contents-as-binary file)))) -(luna-define-method elmo-folder-creatable-p ((folder elmo-cache-folder)) - nil) - (luna-define-method elmo-folder-writable-p ((folder elmo-cache-folder)) t) diff --git a/elmo/elmo-dop.el b/elmo/elmo-dop.el index c63ec32..ab3180a 100644 --- a/elmo/elmo-dop.el +++ b/elmo/elmo-dop.el @@ -66,7 +66,7 @@ Automatically loaded/saved.") '((elmo-folder-append-buffer-dop-delayed . "Append") (elmo-folder-delete-messages-dop-delayed . "Delete") (elmo-message-encache . "Encache") - (elmo-create-folder . "Create") + (elmo-folder-create-dop-delayed . "Create") (elmo-folder-mark-as-read . "Read") (elmo-folder-unmark-read . "Unread") (elmo-folder-mark-as-important . "Important") @@ -236,8 +236,8 @@ FOLDER is the folder structure." (defsubst elmo-message-encache-dop (folder number &optional read) (elmo-dop-queue-append folder 'elmo-message-encache (list number read))) -(defsubst elmo-create-folder-dop (folder) - (elmo-dop-queue-append folder 'elmo-folder-create nil)) +(defsubst elmo-folder-create-dop (folder) + (elmo-dop-queue-append folder 'elmo-folder-create-dop-delayed nil)) (defsubst elmo-folder-mark-as-read-dop (folder numbers) (elmo-dop-queue-append folder 'elmo-folder-mark-as-read (list numbers))) @@ -302,6 +302,10 @@ FOLDER is the folder structure." 'message-id)))) number-alist)))) +(defun elmo-folder-create-dop-delayed (folder) + (unless (elmo-folder-exists-p folder) + (elmo-folder-create folder))) + ;;; Util (defun elmo-dop-msgdb (msgdb) (list (mapcar (function diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 795d27f..a3b04fe 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -1981,6 +1981,9 @@ Return nil if no complete line has arrived." (elmo-imap4-folder-mailbox-internal folder) 'force 'notify-bye)))) +(luna-define-method elmo-folder-creatable-p ((folder elmo-imap4-folder)) + t) + (luna-define-method elmo-folder-writable-p ((folder elmo-imap4-folder)) t) @@ -2443,7 +2446,7 @@ If optional argument REMOVE is non-nil, remove FLAG." (elmo-file-cache-path cache-file))))))) -(luna-define-method elmo-folder-create ((folder elmo-imap4-folder)) +(luna-define-method elmo-folder-create-plugged ((folder elmo-imap4-folder)) (elmo-imap4-send-command-wait (elmo-imap4-get-session folder) (list "create " diff --git a/elmo/elmo-net.el b/elmo/elmo-net.el index 1d59733..bfc2d4b 100644 --- a/elmo/elmo-net.el +++ b/elmo/elmo-net.el @@ -335,10 +335,20 @@ Returned value is searched from `elmo-network-stream-type-alist'." (append (elmo-net-port-info folder) (list nil nil (quote (elmo-net-port-label folder)) add)))) +(luna-define-method elmo-folder-create ((folder elmo-net-folder)) + (if (elmo-folder-plugged-p folder) + (elmo-folder-send folder 'elmo-folder-create-plugged) + (elmo-folder-send folder 'elmo-folder-create-unplugged))) + +(luna-define-method elmo-folder-create-unplugged ((folder elmo-net-folder)) + (if elmo-enable-disconnected-operation + (elmo-folder-create-dop folder) + (error "Unplugged"))) + (luna-define-method elmo-folder-exists-p ((folder elmo-net-folder)) (if (elmo-folder-plugged-p folder) (elmo-folder-send folder 'elmo-folder-exists-p-plugged) - t)) ; If unplugged, assume the folder exists. + nil)) ; If unplugged, assume the folder not exists. (luna-define-method elmo-folder-status ((folder elmo-net-folder)) (if (elmo-folder-plugged-p folder) diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index c9071b2..f1b84fb 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -1088,16 +1088,13 @@ Don't cache if nil.") (elmo-folder-set-killed-list-internal folder killed-list)) t) -(luna-define-method elmo-folder-exists-p ((folder elmo-nntp-folder)) +(luna-define-method elmo-folder-exists-p-plugged ((folder elmo-nntp-folder)) (let ((session (elmo-nntp-get-session folder))) - (if (elmo-folder-plugged-p folder) - (progn (elmo-nntp-send-command session (format "group %s" (elmo-nntp-folder-group-internal folder))) - (elmo-nntp-read-response session)) - t))) + (elmo-nntp-read-response session))) (defun elmo-nntp-retrieve-field (spec field from-msgs) "Retrieve FIELD values from FROM-MSGS. @@ -1466,9 +1463,6 @@ Returns a list of cons cells like (NUMBER . VALUE)" (luna-define-method elmo-message-use-cache-p ((folder elmo-nntp-folder) number) elmo-nntp-use-cache) -(luna-define-method elmo-folder-creatable-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-pop3.el b/elmo/elmo-pop3.el index 89e2ad0..26a8426 100644 --- a/elmo/elmo-pop3.el +++ b/elmo/elmo-pop3.el @@ -458,7 +458,7 @@ Debug information is inserted in the buffer \"*POP3 DEBUG*\"") (setq session (elmo-pop3-get-session folder)) (if session (elmo-network-close-session session))))) - t)) + nil)) (defun elmo-pop3-parse-uidl-response (string) (let ((buffer (current-buffer)) diff --git a/elmo/elmo-sendlog.el b/elmo/elmo-sendlog.el index d0362c7..3cf0bc5 100644 --- a/elmo/elmo-sendlog.el +++ b/elmo/elmo-sendlog.el @@ -137,12 +137,6 @@ (insert-file-contents-as-binary filename) (error "Now this message is not cached. Please s all")))) -(luna-define-method elmo-folder-creatable-p ((folder elmo-sendlog-folder)) - nil) - -(luna-define-method elmo-folder-writable-p ((folder elmo-sendlog-folder)) - nil) - (luna-define-method elmo-folder-exists-p ((folder elmo-sendlog-folder)) t) diff --git a/elmo/elmo-shimbun.el b/elmo/elmo-shimbun.el index 2828509..332a7e6 100644 --- a/elmo/elmo-shimbun.el +++ b/elmo/elmo-shimbun.el @@ -251,9 +251,6 @@ update overview when message is fetched." number) elmo-shimbun-use-cache) -(luna-define-method elmo-folder-creatable-p ((folder elmo-shimbun-folder)) - nil) - (luna-define-method elmo-folder-close-internal :after ((folder elmo-shimbun-folder)) (shimbun-close-group diff --git a/elmo/elmo.el b/elmo/elmo.el index 7eb82fd..8b3c07a 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -692,7 +692,7 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (elmo-folder-persistent-internal folder)) (luna-define-method elmo-folder-creatable-p ((folder elmo-folder)) - t) ; default is creatable. + nil) ; default is not creatable. (luna-define-method elmo-folder-writable-p ((folder elmo-folder)) nil) ; default is not writable. diff --git a/wl/ChangeLog b/wl/ChangeLog index 848a886..4ed2b19 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,11 @@ 2002-04-03 Hiroya Murata + * wl-summary.el (wl-summary-refile-subr): Cause an error if FOLDER + is not writable. + + * wl-folder.el (wl-folder-create-subr): Cause an error if FOLDER + is not creatable. + * Version number is increased to 2.9.9. 2002-04-03 Kenichi OKADA diff --git a/wl/wl-folder.el b/wl/wl-folder.el index 2e0d1b9..2513336 100644 --- a/wl/wl-folder.el +++ b/wl/wl-folder.el @@ -2797,6 +2797,7 @@ Call `wl-summary-write-current-folder' with current folder name." (kill-buffer bufname)))) (defun wl-folder-create-subr (folder) + (if (elmo-folder-creatable-p folder) (if (y-or-n-p (format "Folder %s does not exist, create it? " (elmo-folder-name-internal folder))) (progn @@ -2807,7 +2808,8 @@ Call `wl-summary-write-current-folder' with current folder name." wl-folder-entity-hashtb)) (unless (elmo-folder-create folder) (error "Create folder failed"))) - (error "Folder %s is not created" (elmo-folder-name-internal folder)))) + (error "Folder %s is not created" (elmo-folder-name-internal folder))) + (error "Folder %s does not exist" (elmo-folder-name-internal folder)))) (defun wl-folder-confirm-existence (folder &optional force) (if force diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 010ab10..0750cb1 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -3384,7 +3384,8 @@ If optional argument NUMBER is specified, mark message specified by NUMBER." (message "Force refile to %s." folder))) (if (string= folder (wl-summary-buffer-folder-name)) (error "Same folder")) - (if (or (string= folder wl-queue-folder) + (if (or (not (elmo-folder-writable-p (wl-folder-get-elmo-folder folder))) + (string= folder wl-queue-folder) (string= folder wl-draft-folder)) (error "Don't %s messages to %s" copy-or-refile folder)) ;; learn for refile.