* wl.el (wl-plugged-dop-queue-info): Fixed for new queue structure.
* wl-summary.el (wl-summary-mark-as-important): Set message number
using wl-summary-message-number.
* elmo.el (elmo-message-encache): Define as generic function.
(elmo-message-fetch-field): New generic function.
(elmo-message-fetch-with-cache-process): Cause an error when
fetch strategy is 'entire but only 'section cache is available.
(toplevel): Fixed nmz folder definition.
* elmo-vars.el (elmo-msgdb-lock-list-filename): Removed.
(elmo-msgdb-resume-list-filename): Ditto.
(elmo-queue-filename): Ditto.
(elmo-enable-disconnected-operation): Changed default value to t.
* elmo-util.el (elmo-cache-path-section-p): New function.
(elmo-file-cache-get): Use it.
(elmo-dop-queue-filename): Moved from elmo-dop.el.
(elmo-dop-queue-load): Moved from elmo-msgdb.el.
(elmo-dop-queue-save): Ditto.
* elmo-net.el (elmo-folder-status-unplugged): Call
elmo-folder-status-dop.
(elmo-folder-list-messages-unplugged): Implemented.
(elmo-folder-delete-messages-unplugged): Define.
(elmo-folder-msgdb-create): Define.
(elmo-folder-msgdb-create-unplugged): Define.
(elmo-folder-mark-as-read-unplugged): Ditto.
(elmo-folder-unmark-read-unplugged): Ditto.
(elmo-folder-mark-as-important-unplugged): Ditto.
(elmo-folder-unmark-important-unplugged): Ditto.
(elmo-message-encache): Ditto.
* elmo-msgdb.el (elmo-dop-queue-load): Moved to elmo-util.el.
(elmo-dop-queue-save): Ditto.
* elmo-imap4.el (elmo-folder-msgdb-create-plugged): Renamed from
`elmo-folder-msgdb-create'.
(elmo-folder-append-buffer): Implemented unplugged operation.
(elmo-folder-append-messages): Call parent method in unplugged status.
(elmo-message-fetch-unplugged): Removed definition.
(elmo-message-fetch-field): Implemented.
* elmo-dop.el (toplevel): Require 'elmo-localdir.
(elmo-dop-folder): Removed variable definition.
(elmo-dop-queue-append): Changed argument `fname' to `folder'.
(elmo-dop-queue-flush): Implemented.
(elmo-dop-queue-merge): Removed definition (TODO).
(elmo-dop-spool-folder): New function.
(elmo-dop-spool-folder-append-buffer): Ditto.
(elmo-dop-spool-folder-list-messages): Ditto.
(elmo-dop-list-deleting-messages): Ditto.
(elmo-folder-append-buffer-dop): Ditto.
(elmo-folder-delete-messages-dop): Ditto.
(elmo-message-encache-dop): New inline function.
(elmo-create-folder-dop): Ditto.
(elmo-folder-mark-as-read-dop): Ditto.
(elmo-folder-unmark-read-dop): Ditto.
(elmo-folder-mark-as-important-dop): Ditto.
(elmo-folder-unmark-important-dop): Ditto.
(elmo-folder-status-dop): Fixed.
(elmo-folder-append-buffer-dop-delayed): New function.
(elmo-folder-delete-messages-dop-delayed): Ditto.
(elmo-dop-msgdb): Ditto.
+2001-05-10 Yuuichi Teranishi <teranisi@gohome.org>
+
+ * elmo.el (elmo-message-encache): Define as generic function.
+ (elmo-message-fetch-field): New generic function.
+ (elmo-message-fetch-with-cache-process): Cause an error when
+ fetch strategy is 'entire but only 'section cache is available.
+ (toplevel): Fixed nmz folder definition.
+
+ * elmo-vars.el (elmo-msgdb-lock-list-filename): Removed.
+ (elmo-msgdb-resume-list-filename): Ditto.
+ (elmo-queue-filename): Ditto.
+ (elmo-enable-disconnected-operation): Changed default value to t.
+
+ * elmo-util.el (elmo-cache-path-section-p): New function.
+ (elmo-file-cache-get): Use it.
+ (elmo-dop-queue-filename): Moved from elmo-dop.el.
+ (elmo-dop-queue-load): Moved from elmo-msgdb.el.
+ (elmo-dop-queue-save): Ditto.
+
+ * elmo-net.el (elmo-folder-status-unplugged): Call
+ elmo-folder-status-dop.
+ (elmo-folder-list-messages-unplugged): Implemented.
+ (elmo-folder-delete-messages-unplugged): Define.
+ (elmo-folder-msgdb-create): Define.
+ (elmo-folder-msgdb-create-unplugged): Define.
+ (elmo-folder-mark-as-read-unplugged): Ditto.
+ (elmo-folder-unmark-read-unplugged): Ditto.
+ (elmo-folder-mark-as-important-unplugged): Ditto.
+ (elmo-folder-unmark-important-unplugged): Ditto.
+ (elmo-message-encache): Ditto.
+
+ * elmo-msgdb.el (elmo-dop-queue-load): Moved to elmo-util.el.
+ (elmo-dop-queue-save): Ditto.
+
+ * elmo-imap4.el (elmo-folder-msgdb-create-plugged): Renamed from
+ `elmo-folder-msgdb-create'.
+ (elmo-folder-append-buffer): Implemented unplugged operation.
+ (elmo-folder-append-messages): Call parent method in unplugged status.
+ (elmo-message-fetch-unplugged): Removed definition.
+ (elmo-message-fetch-field): Implemented.
+
+ * elmo-dop.el (toplevel): Require 'elmo-localdir.
+ (elmo-dop-folder): Removed variable definition.
+ (elmo-dop-queue-append): Changed argument `fname' to `folder'.
+ (elmo-dop-queue-flush): Implemented.
+ (elmo-dop-queue-merge): Removed definition (TODO).
+ (elmo-dop-spool-folder): New function.
+ (elmo-dop-spool-folder-append-buffer): Ditto.
+ (elmo-dop-spool-folder-list-messages): Ditto.
+ (elmo-dop-list-deleting-messages): Ditto.
+ (elmo-folder-append-buffer-dop): Ditto.
+ (elmo-folder-delete-messages-dop): Ditto.
+ (elmo-message-encache-dop): New inline function.
+ (elmo-create-folder-dop): Ditto.
+ (elmo-folder-mark-as-read-dop): Ditto.
+ (elmo-folder-unmark-read-dop): Ditto.
+ (elmo-folder-mark-as-important-dop): Ditto.
+ (elmo-folder-unmark-important-dop): Ditto.
+ (elmo-folder-status-dop): Fixed.
+ (elmo-folder-append-buffer-dop-delayed): New function.
+ (elmo-folder-delete-messages-dop-delayed): Ditto.
+ (elmo-dop-msgdb): Ditto.
+
2001-05-10 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* elmo-localdir.el (elmo-folder-pack-numbers): Fixed.
(require 'elmo-vars)
(require 'elmo-msgdb)
(require 'elmo-util)
+(require 'elmo-localdir)
;; global variable.
(defvar elmo-dop-queue nil
"A list of (folder-name function-to-be-called argument-list).
Automatically loaded/saved.")
-(defvar elmo-dop-folder (concat "+" (expand-file-name "dop"
- elmo-msgdb-dir))
- "A folder for `elmo-folder-append-messages' disconnected operations.")
-
(defmacro elmo-make-dop-queue (fname method arguments)
"Make a dop queue."
(` (vector (, fname) (, method) (, arguments))))
"Return the arguments of the QUEUE."
(` (aref (, queue) 2)))
-(defun elmo-dop-queue-append (fname method arguments)
+(defun elmo-dop-queue-append (folder method arguments)
"Append to disconnected operation queue."
- (let ((queue (elmo-make-dop-queue fname method arguments)))
+ (let ((queue (elmo-make-dop-queue (elmo-folder-name-internal folder)
+ method arguments)))
(setq elmo-dop-queue (nconc elmo-dop-queue (list queue)))))
(defun elmo-dop-queue-flush (&optional force)
(elmo-dop-queue-merge)
(let ((queue elmo-dop-queue)
(count 0)
+ folder
len)
- (while queue
- (if (or force (elmo-folder-plugged-p (elmo-make-folder (caar queue))))
- (setq count (1+ count)))
- (setq queue (cdr queue)))
+ ;; obsolete
+ (unless (or (null queue)
+ (vectorp (car queue)))
+ (when (y-or-n-p "Saved queue is old version(2.4). Clear all pending operations? ")
+ (setq elmo-dop-queue nil)
+ (message "All pending operations are cleared.")
+ (elmo-dop-queue-save)))
+ (setq count (length queue))
(when (> count 0)
(if (elmo-y-or-n-p
(format "%d pending operation(s) exists. Perform now? " count)
(setq i (+ 1 i))
(message "Flushing queue....%d/%d." i num)
(condition-case err
- (apply (elmo-dop-queue-method (car queue))
- (elmo-dop-queue-fname (car queue))
- (elmo-dop-queue-arguments queue))
+ (progn
+ (apply (elmo-dop-queue-method (car queue))
+ (prog1
+ (setq folder
+ (elmo-make-folder
+ (elmo-dop-queue-fname (car queue))))
+ (elmo-folder-open folder))
+ (elmo-dop-queue-arguments (car queue)))
+ (elmo-folder-close folder))
(quit (setq failure t))
(error (setq failure err)))
(if failure
(defvar elmo-dop-merge-funcs nil)
(defun elmo-dop-queue-merge ()
- (let ((queue elmo-dop-queue)
- new-queue match-queue que)
- (while (setq que (car queue))
- (if (and
- (member (cadr que) elmo-dop-merge-funcs)
- (setq match-queue
- (car (delete nil
- (mapcar
- (lambda (new-queue)
- (if (and
- (string= (car que) (car new-queue))
- (string= (cadr que) (cadr new-queue)))
- new-queue))
- new-queue)))))
- (setcar (cddr match-queue)
- (append (nth 2 match-queue) (nth 2 que)))
- (setq new-queue (append new-queue (list que))))
- (setq queue (cdr queue)))
- (setq elmo-dop-queue new-queue)))
-
-
-;;; Execution is delayed.
-
-
-;;; Offline append:
-;; If appended message is local file or cached, it is saved in
-;; .elmo/dop/1 2 3 4 ...
-;; then msgdb-path/append file is created and contain message number list.
-;; ex. (1 3 5)
-
-(defun elmo-folder-append-buffer-dop (folder unread &optional number)
+ ;; XXXX Not implemented yet.
)
-(defun elmo-folder-delete-messages-dop (folder numbers)
- )
+;;; dop spool folder
+(defmacro elmo-dop-spool-folder (folder)
+ "Return a spool folder for disconnected operations
+which is corresponded to the FOLDER."
+ (` (elmo-make-folder
+ (concat "+" (expand-file-name "spool" (elmo-folder-msgdb-path
+ (, folder)))))))
-(defun elmo-folder-encache-dop (folder numbers)
- )
+(defun elmo-dop-spool-folder-append-buffer (folder)
+ "Append current buffer content to the dop spool folder.
+FOLDER is the folder structure.
+Return a message number."
+ (setq folder (elmo-dop-spool-folder folder))
+ (let ((new-number (1+ (car (elmo-folder-status folder)))))
+ (unless (elmo-folder-exists-p folder)
+ (elmo-folder-create folder))
+ ;; dop folder is a localdir folder.
+ (write-region-as-binary (point-min) (point-max)
+ (expand-file-name
+ (int-to-string new-number)
+ (elmo-localdir-folder-directory-internal folder))
+ nil 'no-msg)
+ new-number))
+
-(defun elmo-create-folder-dop (folder)
- )
+(defun elmo-dop-spool-folder-list-messages (folder)
+ "List messages in the dop spool folder.
+FOLDER is the folder structure."
+ (setq folder (elmo-dop-spool-folder folder))
+ (if (elmo-folder-exists-p folder)
+ (elmo-folder-list-messages folder)))
+
+(defun elmo-dop-list-deleting-messages (folder)
+ "List messages which are on the deleting queue for the folder.
+FOLDER is the folder structure."
+ (let (messages)
+ (dolist (queue elmo-dop-queue)
+ (if (and (string= (elmo-dop-queue-fname queue)
+ (elmo-folder-name-internal folder))
+ (eq (elmo-dop-queue-method queue)
+ 'elmo-folder-delete-messages-dop-delayed))
+ (setq messages (nconc messages
+ (mapcar
+ 'car
+ (car (elmo-dop-queue-arguments queue)))))))))
+
+;;; DOP operations.
+(defsubst elmo-folder-append-buffer-dop (folder unread &optional number)
+ (elmo-dop-queue-append
+ folder 'elmo-folder-append-buffer-dop-delayed
+ (list unread
+ (elmo-dop-spool-folder-append-buffer
+ folder)
+ number)))
+
+(defsubst elmo-folder-delete-messages-dop (folder numbers)
+ (elmo-dop-queue-append folder 'elmo-folder-delete-messages-dop-delayed
+ (list
+ (mapcar
+ (lambda (number)
+ (cons number (elmo-message-field
+ folder number 'message-id)))
+ numbers)))
+ t)
+
+(defsubst elmo-message-encache-dop (folder number)
+ (elmo-dop-queue-append folder 'elmo-message-encache (list number)))
+
+(defsubst elmo-create-folder-dop (folder)
+ (elmo-dop-queue-append folder 'elmo-folder-create nil))
+
+(defsubst elmo-folder-mark-as-read-dop (folder numbers)
+ (elmo-dop-queue-append folder 'elmo-folder-mark-as-read (list numbers)))
+
+(defsubst elmo-folder-unmark-read-dop (folder numbers)
+ (elmo-dop-queue-append folder 'elmo-folder-unmark-read (list numbers)))
+
+(defsubst elmo-folder-mark-as-important-dop (folder numbers)
+ (elmo-dop-queue-append folder 'elmo-folder-mark-as-important (list numbers)))
+
+(defsubst elmo-folder-unmark-important-dop (folder numbers)
+ (elmo-dop-queue-append folder 'elmo-folder-unmark-important (list numbers)))
;;; Execute as subsutitute for plugged operation.
(defun elmo-folder-status-dop (folder)
(let* ((number-alist (elmo-msgdb-number-load
(elmo-folder-msgdb-path folder)))
(number-list (mapcar 'car number-alist))
+ (spool-folder (elmo-dop-spool-folder folder))
+ spool-length
(i 0)
max-num)
- ;; number of messages which are queued as append should be added
- ;; to max-num and length.
+ (setq spool-length (length (car (if (elmo-folder-exists-p spool-folder)
+ (elmo-folder-status spool-folder)))))
(setq max-num
(or (nth (max (- (length number-list) 1) 0) number-list)
0))
- (cons max-num number-list)))
+ (cons (+ max-num spool-length) (+ (length number-list) spool-length))))
+
+;;; Delayed operation (executed at online status).
+(defun elmo-folder-append-buffer-dop-delayed (folder unread number set-number)
+ (let ((spool-folder (elmo-dop-spool-folder folder)))
+ (with-temp-buffer
+ (elmo-message-fetch spool-folder number
+ (elmo-make-fetch-strategy 'entire)
+ nil (current-buffer) 'unread)
+ (condition-case nil
+ (elmo-folder-append-buffer folder unread set-number)
+ (error
+ ;; Append failed...
+ (elmo-folder-append-buffer (elmo-make-folder elmo-lost+found-folder)
+ unread set-number)))
+ (elmo-folder-delete-messages spool-folder (list number))
+ t)))
+
+(defun elmo-folder-delete-messages-dop-delayed (folder number-alist)
+ (elmo-folder-delete-messages
+ folder
+ ;; messages are deleted only if message-id is not changed.
+ (mapcar 'car
+ (elmo-delete-if
+ (lambda (pair)
+ (not (string=
+ (cdr pair)
+ (elmo-message-fetch-field folder (car pair)
+ 'message-id))))
+ number-alist))))
+
+;;; Util
+(defun elmo-dop-msgdb (msgdb)
+ (list (mapcar (function
+ (lambda (x)
+ (elmo-msgdb-overview-entity-set-number
+ x
+ (* -1
+ (elmo-msgdb-overview-entity-get-number x)))))
+ (nth 0 msgdb))
+ (mapcar (function
+ (lambda (x) (cons
+ (* -1 (car x))
+ (cdr x))))
+ (nth 1 msgdb))
+ (mapcar (function
+ (lambda (x) (cons
+ (* -1 (car x))
+ (cdr x)))) (nth 2 msgdb))))
(require 'product)
(product-provide (provide 'elmo-dop) (require 'elmo-version))
(elmo-imap4-folder-mailbox-internal folder))
(elmo-imap4-search-internal folder session condition numbers))))
-(luna-define-method elmo-folder-msgdb-create
+(luna-define-method elmo-folder-msgdb-create-plugged
((folder elmo-imap4-folder) numbers &rest args)
(when numbers
(let ((session (elmo-imap4-get-session folder))
(luna-define-method elmo-folder-append-buffer
((folder elmo-imap4-folder) unread &optional number)
- (let ((session (elmo-imap4-get-session folder))
- send-buffer result)
- (elmo-imap4-session-select-mailbox session
- (elmo-imap4-folder-mailbox-internal
- folder))
- (setq send-buffer (elmo-imap4-setup-send-buffer))
- (unwind-protect
- (setq result
- (elmo-imap4-send-command-wait
- session
- (list
- "append "
- (elmo-imap4-mailbox (elmo-imap4-folder-mailbox-internal
- folder))
- (if unread " " " (\\Seen) ")
- (elmo-imap4-buffer-literal send-buffer))))
- (kill-buffer send-buffer))
- result))
+ (if (elmo-folder-plugged-p folder)
+ (let ((session (elmo-imap4-get-session folder))
+ send-buffer result)
+ (elmo-imap4-session-select-mailbox session
+ (elmo-imap4-folder-mailbox-internal
+ folder))
+ (setq send-buffer (elmo-imap4-setup-send-buffer))
+ (unwind-protect
+ (setq result
+ (elmo-imap4-send-command-wait
+ session
+ (list
+ "append "
+ (elmo-imap4-mailbox (elmo-imap4-folder-mailbox-internal
+ folder))
+ (if unread " " " (\\Seen) ")
+ (elmo-imap4-buffer-literal send-buffer))))
+ (kill-buffer send-buffer))
+ result)
+ ;; Unplugged
+ (if elmo-enable-disconnected-operation
+ (elmo-folder-append-buffer-dop folder unread number)
+ (error "Unplugged"))))
(eval-when-compile
(defmacro elmo-imap4-identical-system-p (folder1 folder2)
((folder elmo-imap4-folder) src-folder numbers unread-marks
&optional same-number)
(if (and (eq (elmo-folder-type-internal src-folder) 'imap4)
- (elmo-imap4-identical-system-p folder src-folder))
+ (elmo-imap4-identical-system-p folder src-folder)
+ (elmo-folder-plugged-p folder))
+ ;; Plugged
(elmo-imap4-copy-messages src-folder folder numbers)
(luna-call-next-method)))
(elmo-imap4-get-session folder)))
elmo-enable-disconnected-operation)) ; offline refile.
-(luna-define-method elmo-message-fetch-unplugged
- ((folder elmo-imap4-folder)
- number strategy &optional section outbuf unseen)
- (error "%d%s is not cached." number (if section
- (format "(%s)" section)
- "")))
+;(luna-define-method elmo-message-fetch-unplugged
+; ((folder elmo-imap4-folder)
+; number strategy &optional section outbuf unseen)
+; (error "%d%s is not cached." number (if section
+; (format "(%s)" section)
+; "")))
(defsubst elmo-imap4-message-fetch (folder number strategy
section outbuf unseen)
outbuf unseen)
(elmo-imap4-message-fetch folder number strategy section outbuf unseen))
+(luna-define-method elmo-message-fetch-field ((folder elmo-imap4-folder)
+ number field)
+ (let ((session (elmo-imap4-get-session folder)))
+ (elmo-imap4-session-select-mailbox session
+ (elmo-imap4-folder-mailbox-internal
+ folder))
+ (with-current-buffer (elmo-network-session-buffer session)
+ (setq elmo-imap4-fetch-callback nil)
+ (setq elmo-imap4-fetch-callback-data nil))
+ (with-temp-buffer
+ (insert
+ (elmo-imap4-response-bodydetail-text
+ (elmo-imap4-response-value
+ (elmo-imap4-send-command-wait session
+ (concat
+ (if elmo-imap4-use-uid
+ "uid ")
+ (format
+ "fetch %s (body.peek[header.fields (%s)])"
+ number field)))
+ 'fetch)))
+ (elmo-delete-cr-buffer)
+ (goto-char (point-min))
+ (std11-field-body (symbol-name field)))))
+
+
+
(require 'product)
(product-provide (provide 'elmo-imap4) (require 'elmo-version))
elmo-msgdb-location-filename
dir) alist))
-(defun elmo-dop-queue-load ()
- (setq elmo-dop-queue
- (elmo-object-load
- (expand-file-name elmo-queue-filename
- elmo-msgdb-dir))))
-
-(defun elmo-dop-queue-save ()
- (elmo-object-save
- (expand-file-name elmo-queue-filename
- elmo-msgdb-dir)
- elmo-dop-queue))
-
(require 'product)
(product-provide (provide 'elmo-msgdb) (require 'elmo-version))
(luna-define-method elmo-folder-status-unplugged
((folder elmo-net-folder))
(if elmo-enable-disconnected-operation
- () ; XXX FIXME. (elmo-folder-status-dop folder)
+ (elmo-folder-status-dop folder)
(error "Unplugged")))
(luna-define-method elmo-folder-list-messages-internal
((folder elmo-net-folder))
t)
-;; XXX
;; Should consider offline append and removal.
-(luna-define-method elmo-folder-list-messages-unplugged
- ((folder elmo-net-folder))
+(luna-define-method elmo-folder-list-messages-unplugged ((folder
+ elmo-net-folder))
(if elmo-enable-disconnected-operation
- t
+ (let ((deleting (elmo-dop-list-deleting-messages folder)))
+ (nconc
+ ;; delete deleting messages
+ (elmo-delete-if
+ (lambda (number) (memq number deleting))
+ ;; current number-list.
+ (mapcar
+ 'car
+ (elmo-msgdb-get-number-alist (elmo-folder-msgdb folder))))
+ ;; append appending messages
+ (mapcar (lambda (x) (* -1 x))
+ (elmo-dop-spool-folder-list-messages folder))))
(error "Unplugged")))
(luna-define-method elmo-folder-list-unreads-internal
(elmo-folder-send folder 'elmo-folder-delete-messages-plugged numbers)
(elmo-folder-send folder 'elmo-folder-delete-messages-unplugged numbers)))
+(luna-define-method elmo-folder-delete-messages-unplugged ((folder
+ elmo-net-folder)
+ numbers)
+ (elmo-folder-delete-messages-dop folder numbers))
+
+(luna-define-method elmo-folder-msgdb-create ((folder elmo-net-folder)
+ numbers new-mark
+ already-mark seen-mark
+ important-mark seen-list)
+ (if (elmo-folder-plugged-p folder)
+ (elmo-folder-send folder 'elmo-folder-msgdb-create-plugged
+ numbers
+ new-mark
+ already-mark seen-mark
+ important-mark seen-list)
+ (elmo-folder-send folder 'elmo-folder-msgdb-create-unplugged
+ numbers
+ new-mark already-mark seen-mark
+ important-mark seen-list)))
+
+(luna-define-method elmo-folder-msgdb-create-unplugged ((folder
+ elmo-net-folder)
+ numbers
+ new-mark already-mark
+ seen-mark
+ important-mark
+ seen-list)
+ ;; XXXX should be appended to already existing msgdb.
+ (elmo-dop-msgdb
+ (elmo-folder-msgdb-create (elmo-dop-spool-folder folder)
+ (mapcar 'abs numbers)
+ new-mark already-mark
+ seen-mark
+ important-mark
+ seen-list)))
+
(luna-define-method elmo-folder-unmark-important ((folder elmo-net-folder)
numbers)
(if (elmo-folder-use-flag-p folder)
folder 'elmo-folder-mark-as-read-unplugged numbers))
t))
+(luna-define-method elmo-folder-mark-as-read-unplugged ((folder
+ elmo-net-folder)
+ numbers)
+ (elmo-folder-mark-as-read-dop folder numbers))
+
+(luna-define-method elmo-folder-unmark-read-unplugged ((folder elmo-net-folder)
+ numbers)
+ (elmo-folder-unmark-read-dop folder numbers))
+
+(luna-define-method elmo-folder-mark-as-important-unplugged ((folder
+ elmo-net-folder)
+ numbers)
+ (elmo-folder-mark-as-important-dop folder numbers))
+
+(luna-define-method elmo-folder-unmark-important-unplugged ((folder
+ elmo-net-folder)
+ numbers)
+ (elmo-folder-unmark-important-dop folder numbers))
+
+(luna-define-method elmo-message-encache :around ((folder elmo-folder) number)
+ (if (elmo-folder-plugged-p folder)
+ (luna-call-next-method)
+ (if elmo-enable-disconnected-operation
+ (elmo-message-encache-dop folder number)
+ (error "Unplugged"))))
+
(luna-define-generic elmo-message-fetch-plugged (folder number strategy
&optional
section
(luna-define-method elmo-message-fetch-unplugged
((folder elmo-net-folder) number strategy &optional section outbuf unseen)
- (error "Unplugged"))
+ (if elmo-enable-disconnected-operation
+ (if (< number 0)
+ (elmo-message-fetch-internal
+ (elmo-dop-spool-folder folder) (abs number) strategy
+ section outbuf unseen)
+ (elmo-message-fetch
+ folder number
+ ;; fetch with entire cache process.
+ (elmo-make-fetch-strategy 'entire
+ t nil
+ (elmo-file-cache-path
+ (elmo-file-cache-get
+ (elmo-message-field folder number
+ 'message-id))))
+ section outbuf unseen))
+ (error "Unplugged")))
(luna-define-method elmo-folder-check ((folder elmo-net-folder))
(if (elmo-folder-plugged-p folder)
;; ignore error
(error)))
+(defun elmo-cache-path-section-p (path)
+ "Return non-nil when PATH is `section' cache path."
+ (file-directory-p path))
+
(defun elmo-file-cache-get (msgid &optional section)
"Returns the current file-cache object associated with MSGID.
MSGID is the message-id of the message.
(if msgid
(let ((path (elmo-cache-get-path msgid)))
(if (and path (file-exists-p path))
- (if (file-directory-p path)
+ (if (elmo-cache-path-section-p path)
(if section
(if (file-exists-p (setq path (expand-file-name
section path)))
(elmo-resque-obsolete-variable (cdr pair)
(car pair))))
+;;; Queue.
+(defvar elmo-dop-queue-filename "queue"
+ "*Disconnected operation queue is saved in this file.")
+
+(defun elmo-dop-queue-load ()
+ (setq elmo-dop-queue
+ (elmo-object-load
+ (expand-file-name elmo-dop-queue-filename
+ elmo-msgdb-dir))))
+
+(defun elmo-dop-queue-save ()
+ (elmo-object-save
+ (expand-file-name elmo-dop-queue-filename
+ elmo-msgdb-dir)
+ elmo-dop-queue))
(require 'product)
(product-provide (provide 'elmo-util) (require 'elmo-version))
"Folder list cache (for access folder).")
(defvar elmo-msgdb-finfo-filename "finfo"
"Folder information cache...list of '(filename . '(new unread all)).")
-(defvar elmo-msgdb-append-list-filename "append"
- "Appended messages...Structure is same as number-alist.
-For disconnected operations.")
-(defvar elmo-msgdb-resume-list-filename "resume"
- "Resumed messages. For disconnected operations.")
(defvar elmo-msgdb-lock-list-filename "lock"
"Locked messages...list of message-id.
For disconnected operations.")
(defvar elmo-msgdb-extra-fields nil
"Extra fields for msgdb.")
-(defvar elmo-queue-filename "queue"
- "*IMAP pending event queue is saved in this file.")
-(defvar elmo-enable-disconnected-operation nil
+(defvar elmo-enable-disconnected-operation t
"*Enable disconnected operations.")
(defvar elmo-auto-change-plugged 600
(dolist (number numbers)
(elmo-message-encache folder number)))
-(defun elmo-message-encache (folder number)
- "Encache message in the FOLDER with NUMBER."
+(luna-define-generic elmo-message-encache (folder number)
+ "Encache message in the FOLDER with NUMBER.")
+
+(luna-define-method elmo-message-encache ((folder elmo-folder) number)
(elmo-message-fetch
folder number
(elmo-make-fetch-strategy 'entire
If second optional argument UNREAD is non-nil, message is not marked as read.
Returns non-nil if fetching was succeed.")
+(luna-define-generic elmo-message-fetch-field (folder number field)
+ "Fetch a message field value.
+FOLDER is the ELMO folder structure.
+NUMBER is the number of the message in the FOLDER.
+FIELD is a symbol of the field name.")
+
(luna-define-generic elmo-message-folder (folder number)
"Get primitive folder of the message.")
(elmo-fetch-strategy-cache-path strategy)
section))
(file-exists-p cache-file))
- (insert-file-contents-as-binary cache-file)
+ (if (and (elmo-cache-path-section-p cache-file)
+ (eq (elmo-fetch-strategy-entireness strategy) 'entire))
+ (error "Entire message is not cached.")
+ (insert-file-contents-as-binary cache-file))
(elmo-message-fetch-internal folder number strategy section unread)
(elmo-delete-cr-buffer)
(when (and (> (buffer-size) 0)
(elmo-define-folder ?| 'pipe)
(elmo-define-folder ?. 'maildir)
(elmo-define-folder ?' 'internal)
-(elmo-define-folder ?[ 'nmz)
+(elmo-define-folder ?\[ 'nmz)
(elmo-define-folder ?@ 'shimbun)
;;; Obsolete variables.
+2001-05-10 Yuuichi Teranishi <teranisi@gohome.org>
+
+ * wl.el (wl-plugged-dop-queue-info): Fixed for new queue structure.
+
+ * wl-summary.el (wl-summary-mark-as-important): Set message number
+ using wl-summary-message-number.
+
2001-05-10 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* wl-summary.el (wl-summary-exec-subr): Fixed problem when
(setq mark (or mark (cadr (assq number mark-alist)))))
(setq visible t))
(when visible
- (if (null (wl-summary-message-number))
+ (if (null (setq number (wl-summary-message-number)))
(progn
(message "No message.")
(setq visible nil))
(defun wl-plugged-dop-queue-info ()
;; dop queue status
(let* ((count 0)
- elmo-dop-queue dop-queue last alist server-info
+ (elmo-dop-queue (copy-sequence elmo-dop-queue))
+ dop-queue last alist server-info
ope operation)
- (elmo-dop-queue-load)
+ ;(elmo-dop-queue-load)
(elmo-dop-queue-merge)
(setq dop-queue (sort elmo-dop-queue '(lambda (a b)
- (string< (car a) (car b)))))
+ (string< (elmo-dop-queue-fname a)
+ (elmo-dop-queue-fname b)))))
(wl-append dop-queue (list nil)) ;; terminate(dummy)
- (setq last (caar dop-queue)) ;; first
+ (when (car dop-queue)
+ (setq last (elmo-dop-queue-fname (car dop-queue)))) ;; first
(while dop-queue
- (setq ope (cons (nth 1 (car dop-queue))
- (length (nth 2 (car dop-queue)))))
- (if (string= last (caar dop-queue))
+ (when (car dop-queue)
+ (setq ope (cons (elmo-dop-queue-method (car dop-queue))
+ (length
+ (if (listp
+ (car
+ (elmo-dop-queue-arguments (car dop-queue))))
+ (car (elmo-dop-queue-arguments
+ (car dop-queue))))))))
+ (if (and (car dop-queue)
+ (string= last (elmo-dop-queue-fname (car dop-queue))))
(wl-append operation (list ope))
;;(setq count (1+ count))
- (when (and last (setq server-info (elmo-net-port-info last)))
+ (when (and last (setq server-info (elmo-net-port-info
+ (wl-folder-get-elmo-folder last))))
(setq alist
(wl-append-assoc-list
(cons (car server-info) (nth 1 server-info)) ;; server port
(cons last operation)
alist)))
- (setq last (caar dop-queue)
- operation (list ope)))
+ (when (car dop-queue)
+ (setq last (elmo-dop-queue-fname (car dop-queue))
+ operation (list ope))))
(setq dop-queue (cdr dop-queue)))
alist))