+(defsubst elmo-localdir-field-primitive-condition-match (spec
+ condition
+ number
+ number-list)
+ (let (result)
+ (goto-char (point-min))
+ (cond
+ ((string= (elmo-filter-key condition) "last")
+ (setq result (<= (length (memq number number-list))
+ (string-to-int (elmo-filter-value condition)))))
+ ((string= (elmo-filter-key condition) "first")
+ (setq result (< (- (length number-list)
+ (length (memq number number-list)))
+ (string-to-int (elmo-filter-value condition)))))
+ (t
+ (elmo-set-work-buf
+ (as-binary-input-file (insert-file-contents
+ (expand-file-name
+ (int-to-string number)
+ (elmo-localdir-get-folder-directory spec))))
+ (elmo-set-buffer-multibyte default-enable-multibyte-characters)
+ ;; Should consider charset?
+ (decode-mime-charset-region (point-min)(point-max) elmo-mime-charset)
+ (setq result
+ (elmo-buffer-field-primitive-condition-match
+ condition number number-list)))))
+ (if (eq (elmo-filter-type condition) 'unmatch)
+ (setq result (not result)))
+ result))
+
+(defun elmo-localdir-field-condition-match (spec condition number number-list)
+ (cond
+ ((vectorp condition)
+ (elmo-localdir-field-primitive-condition-match
+ spec condition number number-list))
+ ((eq (car condition) 'and)
+ (and (elmo-localdir-field-condition-match
+ spec (nth 1 condition) number number-list)
+ (elmo-localdir-field-condition-match
+ spec (nth 2 condition) number number-list)))
+ ((eq (car condition) 'or)
+ (or (elmo-localdir-field-condition-match
+ spec (nth 1 condition) number number-list)
+ (elmo-localdir-field-condition-match
+ spec (nth 2 condition) number number-list)))))