From: teranisi Date: Tue, 17 Sep 2002 01:46:07 +0000 (+0000) Subject: * elmo-msgdb.el (elmo-msgdb-match-condition-primitive): Added argument X-Git-Tag: elmo-mark-restart~140 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=a87e312d84e5e60b90e787417b240036b4d8b176;p=elisp%2Fwanderlust.git * elmo-msgdb.el (elmo-msgdb-match-condition-primitive): Added argument `mark'; evaluate mark condition. (elmo-msgdb-match-condition-internal): New function. (elmo-msgdb-match-condition): Call it; changed argument. * elmo.el (elmo-folder-search): Follow the API change on `elmo-msgdb-match-condition'. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 4565287..ee906b9 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,13 @@ +2002-09-17 Yuuichi Teranishi + + * elmo-msgdb.el (elmo-msgdb-match-condition-primitive): Added argument + `mark'; evaluate mark condition. + (elmo-msgdb-match-condition-internal): New function. + (elmo-msgdb-match-condition): Call it; changed argument. + + * elmo.el (elmo-folder-search): Follow the API change on + `elmo-msgdb-match-condition'. + 2002-09-17 Hiroya Murata * elmo-filter.el (elmo-folder-msgdb-create): Add to mark-alist if diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index f449a3f..72bb1ad 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -609,7 +609,7 @@ header separator." (expand-file-name elmo-msgdb-overview-filename dir) overview)) -(defun elmo-msgdb-match-condition-primitive (condition entity numbers) +(defun elmo-msgdb-match-condition-primitive (condition mark entity numbers) (catch 'unresolved (let ((key (elmo-filter-key condition)) (case-fold-search t) @@ -629,6 +629,21 @@ header separator." entity) numbers))) (string-to-int (elmo-filter-value condition))))) + ((string= key "mark") + (setq result + (cond + ((string= (elmo-filter-value condition) "any") + (not (or (null mark) + (string= mark elmo-msgdb-read-uncached-mark)))) +;; (member mark (append (elmo-msgdb-answered-marks) +;; (list elmo-msgdb-important-mark) +;; (elmo-msgdb-unread-marks)))) + ((string= (elmo-filter-value condition) "unread") + (member mark (elmo-msgdb-unread-marks))) + ((string= (elmo-filter-value condition) "important") + (string= mark elmo-msgdb-important-mark)) + ((string= (elmo-filter-value condition) "answered") + (member mark (elmo-msgdb-answered-marks)))))) ((string= key "from") (setq result (string-match (elmo-filter-value condition) @@ -671,31 +686,31 @@ header separator." (not result) result)))) -(defun elmo-msgdb-match-condition (condition entity numbers) +(defun elmo-msgdb-match-condition-internal (condition mark entity numbers) (cond ((vectorp condition) - (elmo-msgdb-match-condition-primitive condition entity numbers)) + (elmo-msgdb-match-condition-primitive condition mark entity numbers)) ((eq (car condition) 'and) - (let ((lhs (elmo-msgdb-match-condition (nth 1 condition) - entity numbers))) + (let ((lhs (elmo-msgdb-match-condition-internal (nth 1 condition) + mark entity numbers))) (cond ((elmo-filter-condition-p lhs) - (let ((rhs (elmo-msgdb-match-condition (nth 2 condition) - entity numbers))) + (let ((rhs (elmo-msgdb-match-condition-internal + (nth 2 condition) mark entity numbers))) (cond ((elmo-filter-condition-p rhs) (list 'and lhs rhs)) (rhs lhs)))) (lhs - (elmo-msgdb-match-condition (nth 2 condition) - entity numbers))))) + (elmo-msgdb-match-condition-internal (nth 2 condition) + mark entity numbers))))) ((eq (car condition) 'or) - (let ((lhs (elmo-msgdb-match-condition (nth 1 condition) - entity numbers))) + (let ((lhs (elmo-msgdb-match-condition-internal (nth 1 condition) + mark entity numbers))) (cond ((elmo-filter-condition-p lhs) - (let ((rhs (elmo-msgdb-match-condition (nth 2 condition) - entity numbers))) + (let ((rhs (elmo-msgdb-match-condition-internal (nth 2 condition) + mark entity numbers))) (cond ((elmo-filter-condition-p rhs) (list 'or lhs rhs)) (rhs @@ -705,8 +720,22 @@ header separator." (lhs t) (t - (elmo-msgdb-match-condition (nth 2 condition) - entity numbers))))))) + (elmo-msgdb-match-condition-internal (nth 2 condition) + mark entity numbers))))))) + +(defun elmo-msgdb-match-condition (msgdb condition number numbers) + "Check whether the condition of the message is satisfied or not. +MSGDB is the msgdb to search from. +CONDITION is the search condition. +NUMBER is the message number to check. +NUMBERS is the target message number list. +Return CONDITION itself if no entity exists in msgdb." + (let ((entity (elmo-msgdb-overview-get-entity number msgdb))) + (if entity + (elmo-msgdb-match-condition-internal condition + (elmo-msgdb-get-mark msgdb number) + entity numbers) + condition))) (defsubst elmo-msgdb-set-overview (msgdb overview) (setcar msgdb overview)) diff --git a/elmo/elmo.el b/elmo/elmo.el index 50f31d8..cd7ca16 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -767,14 +767,12 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).") (elmo-progress-set 'elmo-folder-search len "Searching...")) (unwind-protect (dolist (number numbers) - (let ((entity (elmo-msgdb-overview-get-entity number msgdb)) - result) - (if entity - (setq result (elmo-msgdb-match-condition - condition - entity - numbers)) - (setq result condition)) + (let (result) + (setq result (elmo-msgdb-match-condition + msgdb + condition + number + numbers)) (when (elmo-filter-condition-p result) (setq result (elmo-message-match-condition folder