From 88d92346ec94d9f4c094659671c0c591c00d3bbd Mon Sep 17 00:00:00 2001 From: hmurata Date: Fri, 23 Apr 2004 17:53:57 +0000 Subject: [PATCH] * elmo.el (elmo-message-flags): Add optional argument `msgid'. (elmo-generic-folder-append-messages): Call elmo-message-flags with argument `msgid'. * elmo-split.el (elmo-split-subr): Ditto. * elmo-pipe.el (elmo-message-flags): Follow the API change. * elmo-multi.el (elmo-message-flags): Ditto. --- elmo/ChangeLog | 12 ++++++++++++ elmo/elmo-multi.el | 5 +++-- elmo/elmo-pipe.el | 5 +++-- elmo/elmo-split.el | 7 ++++--- elmo/elmo.el | 30 ++++++++++++++++++++---------- 5 files changed, 42 insertions(+), 17 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 33cf690..3bb6bf0 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,15 @@ +2004-04-23 Hiroya Murata + + * elmo.el (elmo-message-flags): Add optional argument `msgid'. + (elmo-generic-folder-append-messages): Call elmo-message-flags + with argument `msgid'. + + * elmo-split.el (elmo-split-subr): Ditto. + + * elmo-pipe.el (elmo-message-flags): Follow the API change. + + * elmo-multi.el (elmo-message-flags): Ditto. + 2004-04-18 Hiroya Murata * elmo.el (elmo-folder): Add new slot `flag-table'. diff --git a/elmo/elmo-multi.el b/elmo/elmo-multi.el index 7ef950f..c9d1368 100644 --- a/elmo/elmo-multi.el +++ b/elmo/elmo-multi.el @@ -181,9 +181,10 @@ (let ((pair (elmo-multi-real-folder-number folder number))) (elmo-message-field (car pair) (cdr pair) field))) -(luna-define-method elmo-message-flags ((folder elmo-multi-folder) number) +(luna-define-method elmo-message-flags ((folder elmo-multi-folder) number + &optional msgid) (let ((pair (elmo-multi-real-folder-number folder number))) - (elmo-message-flags (car pair) (cdr pair)))) + (elmo-message-flags (car pair) (cdr pair) msgid))) (defun elmo-multi-split-numbers (folder numlist &optional as-is) (let ((numbers (sort numlist '<)) diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index e40bf82..33f0f64 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -334,8 +334,9 @@ (luna-define-method elmo-folder-count-flags ((folder elmo-pipe-folder)) (elmo-folder-count-flags (elmo-pipe-folder-dst-internal folder))) -(luna-define-method elmo-message-flags ((folder elmo-pipe-folder) number) - (elmo-message-flags (elmo-pipe-folder-dst-internal folder) number)) +(luna-define-method elmo-message-flags ((folder elmo-pipe-folder) number + &optional msgid) + (elmo-message-flags (elmo-pipe-folder-dst-internal folder) number msgid)) (luna-define-method elmo-message-field ((folder elmo-pipe-folder) number field) diff --git a/elmo/elmo-split.el b/elmo/elmo-split.el index 57bf966..0de97b0 100644 --- a/elmo/elmo-split.el +++ b/elmo/elmo-split.el @@ -316,9 +316,10 @@ If prefix argument ARG is specified, do a reharsal (no harm)." nil (current-buffer) 'unread)) (run-hooks 'elmo-split-fetch-hook) (setq elmo-split-message-entity (mime-parse-buffer)) - (setq flags (or (elmo-message-flags folder msg) - (and (elmo-message-entity folder msg) - '(read)))) + (setq flags (elmo-message-flags + folder + msg + (elmo-msgdb-get-message-id-from-buffer))) (catch 'terminate (dolist (rule (append elmo-split-rule default-rule)) (setq elmo-split-match-string-internal nil) diff --git a/elmo/elmo.el b/elmo/elmo.el index 3d01020..d974213 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -453,13 +453,22 @@ Return newly created temporary directory name which contains temporary files.") (luna-define-generic elmo-message-file-p (folder number) "Return t if message in the FOLDER with NUMBER is a file.") -(luna-define-generic elmo-message-flags (folder number) +(luna-define-generic elmo-message-flags (folder number &optional msgid) "Return a list of flags. FOLDER is a ELMO folder structure. -NUMBER is a number of the message.") - -(luna-define-method elmo-message-flags ((folder elmo-folder) number) - (elmo-msgdb-flags (elmo-folder-msgdb folder) number)) +NUMBER is a number of the message. +If optional argument MSGID is specified, +the message with NUMBER checks whether it has MSGID.") + +(luna-define-method elmo-message-flags ((folder elmo-folder) number + &optional msgid) + (if msgid + (let ((this-id (elmo-message-field folder number 'message-id))) + (and this-id + (string= this-id msgid) + (or (elmo-msgdb-flags (elmo-folder-msgdb folder) number) + '(read)))) + (elmo-msgdb-flags (elmo-folder-msgdb folder) number))) (defsubst elmo-message-flagged-p (folder number flag) "Return non-nil if the message is set FLAG. @@ -1008,7 +1017,7 @@ If optional argument IF-EXISTS is nil, load on demand. (defun elmo-generic-folder-append-messages (folder src-folder numbers same-number) (let ((src-msgdb-exists (not (zerop (elmo-folder-length src-folder)))) - unseen table flags + unseen table succeed-numbers failure cache id) (setq table (elmo-folder-flag-table folder)) (with-temp-buffer @@ -1017,9 +1026,7 @@ If optional argument IF-EXISTS is nil, load on demand. (setq failure nil id (and src-msgdb-exists (elmo-message-field src-folder (car numbers) - 'message-id)) - flags (or (elmo-message-flags src-folder (car numbers)) - (and id '(read)))) + 'message-id))) (condition-case nil (setq cache (elmo-file-cache-get id) failure @@ -1043,7 +1050,10 @@ If optional argument IF-EXISTS is nil, load on demand. (> (buffer-size) 0) (elmo-folder-append-buffer folder - flags + (elmo-message-flags + src-folder + (car numbers) + (elmo-msgdb-get-message-id-from-buffer)) (if same-number (car numbers)))))) (error (setq failure t))) ;; FETCH & APPEND finished -- 1.7.10.4