+(defsubst elmo-filter-folder-list-importants (folder)
+ (elmo-list-filter
+ (elmo-folder-list-messages folder nil 'in-msgdb)
+ (elmo-folder-list-importants
+ (elmo-filter-folder-target-internal folder))))
+
+(luna-define-method elmo-folder-list-importants :around ((folder
+ elmo-filter-folder))
+ (if (elmo-filter-folder-require-msgdb-internal folder)
+ (elmo-filter-folder-list-importants folder)
+ (luna-call-next-method)))
+
+(luna-define-method elmo-folder-list-subfolders ((folder elmo-filter-folder)
+ &optional one-level)
+ (let* ((target (elmo-filter-folder-target-internal folder))
+ (prefix (and (string-match
+ (concat "^\\(.*\\)"
+ (regexp-quote
+ (elmo-folder-name-internal
+ target))
+ "$")
+ (elmo-folder-name-internal folder))
+ (match-string 1 (elmo-folder-name-internal
+ folder)))))
+ (elmo-mapcar-list-of-list
+ (lambda (x) (concat prefix x))
+ (elmo-folder-list-subfolders target one-level))))
+
+(luna-define-method elmo-folder-diff :around ((folder elmo-filter-folder))
+ (let ((condition (elmo-filter-folder-condition-internal folder))
+ diff)
+ (if (vectorp condition)
+ (cond
+ ((and (string= (elmo-filter-key condition) "flag")
+ (or (string= (elmo-filter-value condition) "any")
+ (string= (elmo-filter-value condition) "digest")
+ (string= (elmo-filter-value condition) "unread")))
+ (setq diff (elmo-folder-diff (elmo-filter-folder-target-internal
+ folder)))
+ (if (consp diff)
+ (cons (car diff) (car diff))
+ (cons (car diff) (nth 1 diff))))
+ ((string= "last" (elmo-filter-key condition))
+ (luna-call-next-method))
+ (t
+ (cons nil (cdr (elmo-folder-diff (elmo-filter-folder-target-internal
+ folder))))))
+ (luna-call-next-method))))
+