* elmo-imap4.el (elmo-imap4-fetch-callback-1-subr): Follow the API change.
authorteranisi <teranisi>
Fri, 13 Sep 2002 04:00:18 +0000 (04:00 +0000)
committerteranisi <teranisi>
Fri, 13 Sep 2002 04:00:18 +0000 (04:00 +0000)
(elmo-folder-msgdb-create-plugged): Ditto.
(elmo-folder-append-messages): Ditto.
(elmo-folder-list-answereds-plugged): Define.
(elmo-imap4-search-internal-primitive): Add `mark' processing.
(elmo-folder-unmark-answered-plugged): Define.
(elmo-folder-mark-as-answered-plugged): Ditto.
(elmo-folder-search-requires-msgdb-p): Ditto.

* elmo-filter.el (elmo-filter-folder): Added new slot 'require-msgdb'.
(elmo-folder-initialize): Set it.
(elmo-folder-msgdb): Define.
(elmo-folder-check): Call elmo-folder-synchronize.
(elmo-folder-close): Define.
(elmo-folder-commit): Ditto.
(elmo-folder-msgdb-create): Rewrite.
(elmo-folder-list-unreads): Ditto.
(elmo-folder-list-importants): Ditto.
(elmo-folder-mark-as-read): Ditto.
(elmo-folder-unmark-read): Ditto.
(elmo-folder-mark-as-important): Ditto.
(elmo-folder-unmark-important): Ditto.
(elmo-folder-mark-as-answered): Define.
(elmo-folder-unmark-answered): Ditto.

* elmo-dop.el (elmo-dop-queue-merge-method-list): Added
elmo-folder-mark-as-answered, elmo-folder-unmark-answered.
(elmo-dop-queue-method-name-alist): Likewise.
(elmo-folder-mark-as-answered-dop): New inline function.
(elmo-folder-unmark-answered-dop): Ditto.
(elmo-folder-status-dop): Treat spool-length as 0 if it does not exist.

* elmo-archive.el (elmo-folder-append-messages): Follow the API change.
(elmo-folder-msgdb-create): Ditto.
(elmo-archive-msgdb-create-as-numlist-subr1): Ditto.
(elmo-archive-msgdb-create-as-numlist-subr2): Ditto.
(elmo-archive-parse-mmdf): Ditto.

* elmo-cache.el (elmo-folder-msgdb-create): Ditto.
(elmo-folder-list-unreads-internal): Ditto.

elmo/elmo-archive.el
elmo/elmo-cache.el
elmo/elmo-dop.el
elmo/elmo-filter.el
elmo/elmo-imap4.el

index fe7a2b8..4db7c42 100644 (file)
@@ -607,8 +607,7 @@ TYPE specifies the archiver's symbol."
             nil))))))
 
 (luna-define-method elmo-folder-append-messages :around
-  ((folder elmo-archive-folder) src-folder numbers unread-marks
-   &optional same-number)
+  ((folder elmo-archive-folder) src-folder numbers &optional same-number)
   (let ((prefix (elmo-archive-folder-archive-prefix-internal folder)))
     (cond
      ((and same-number
@@ -901,9 +900,7 @@ TYPE specifies the archiver's symbol."
       (elmo-archive-msgdb-create-entity-subr number))))
 
 (luna-define-method elmo-folder-msgdb-create ((folder elmo-archive-folder)
-                                             numbers new-mark
-                                             already-mark seen-mark
-                                             important-mark seen-list)
+                                             numbers seen-list)
   (when numbers
     (save-excursion ;; 981005
       (if (and elmo-archive-use-izip-agent
@@ -911,17 +908,11 @@ TYPE specifies the archiver's symbol."
                (elmo-archive-folder-archive-type-internal folder)
                'cat-headers))
          (elmo-archive-msgdb-create-as-numlist-subr2
-          folder numbers new-mark already-mark seen-mark important-mark
-          seen-list)
+          folder numbers seen-list)
        (elmo-archive-msgdb-create-as-numlist-subr1
-        folder numbers new-mark already-mark seen-mark important-mark
-        seen-list)))))
+        folder numbers seen-list)))))
 
-(defun elmo-archive-msgdb-create-as-numlist-subr1 (folder
-                                                  numlist new-mark
-                                                  already-mark seen-mark
-                                                  important-mark
-                                                  seen-list)
+(defun elmo-archive-msgdb-create-as-numlist-subr1 (folder numlist seen-list)
   (let* ((type (elmo-archive-folder-archive-type-internal folder))
         (file (elmo-archive-get-archive-name folder))
         (method (elmo-archive-get-method type 'cat))
@@ -954,10 +945,10 @@ TYPE specifies the archiver's symbol."
                             (elmo-file-cache-get message-id))
                            (if seen
                                nil
-                             already-mark)
+                             elmo-msgdb-unread-cached-mark)
                          (if seen
-                             seen-mark
-                           new-mark))))
+                             elmo-msgdb-read-uncached-mark
+                           elmo-msgdb-new-mark))))
              (setq mark-alist
                    (elmo-msgdb-mark-append
                     mark-alist
@@ -975,9 +966,7 @@ TYPE specifies the archiver's symbol."
 
 ;;; info-zip agent
 (defun elmo-archive-msgdb-create-as-numlist-subr2 (folder
-                                                  numlist new-mark
-                                                  already-mark seen-mark
-                                                  important-mark
+                                                  numlist
                                                   seen-list)
   (let* ((delim1 elmo-mmdf-delimiter)          ;; MMDF
         (delim2 elmo-unixmail-delimiter)       ;; UNIX Mail
@@ -1011,10 +1000,7 @@ TYPE specifies the archiver's symbol."
        (goto-char (point-min))
        (cond
         ((looking-at delim1)   ;; MMDF
-         (setq result (elmo-archive-parse-mmdf msgs
-                                               new-mark
-                                               already-mark seen-mark
-                                               seen-list))
+         (setq result (elmo-archive-parse-mmdf msgs seen-list))
          (setq overview (append overview (nth 0 result)))
          (setq number-alist (append number-alist (nth 1 result)))
          (setq mark-alist (append mark-alist (nth 2 result))))
@@ -1033,10 +1019,7 @@ TYPE specifies the archiver's symbol."
           percent))))
     (list overview number-alist mark-alist)))
 
-(defun elmo-archive-parse-mmdf (msgs new-mark
-                                    already-mark
-                                    seen-mark
-                                    seen-list)
+(defun elmo-archive-parse-mmdf (msgs seen-list)
   (let ((delim elmo-mmdf-delimiter)
        number sp ep rest entity overview number-alist mark-alist ret-val
        message-id seen gmark)
@@ -1069,16 +1052,17 @@ TYPE specifies the archiver's symbol."
                             (elmo-file-cache-get message-id))
                            (if seen
                                nil
-                             already-mark)
+                             elmo-msgdb-unread-cached-mark)
                          (if seen
-                             seen-mark
-                           new-mark))))
+                             elmo-msgdb-read-uncached-mark
+                           elmo-msgdb-new-mark))))
              (setq mark-alist
                    (elmo-msgdb-mark-append
                     mark-alist
                     (elmo-msgdb-overview-entity-get-number entity)
                     gmark)))
-         (setq ret-val (append ret-val (list overview number-alist mark-alist)))
+         (setq ret-val (append ret-val (list overview number-alist
+                                             mark-alist)))
          (widen)))
       (forward-line 1)
       (setq rest (cdr rest)))
index 67d80b7..5efac75 100644 (file)
    (elmo-cache-folder-directory-internal folder)))
 
 (luna-define-method elmo-folder-msgdb-create ((folder elmo-cache-folder)
-                                             numbers new-mark
-                                             already-mark seen-mark
-                                             important-mark
-                                             seen-list)
+                                             numbers seen-list)
   (let ((i 0)
        (len (length numbers))
        overview number-alist mark-alist entity message-id
                                     num
                                     message-id))
        (if (setq mark (or (elmo-msgdb-global-mark-get message-id)
-                          (if (member message-id seen-list) nil new-mark)))
+                          (if (member message-id seen-list) nil
+                            elmo-msgdb-new-mark)))
            (setq mark-alist
                  (elmo-msgdb-mark-append
                   mark-alist
 (luna-define-method elmo-message-file-p ((folder elmo-cache-folder) number)
   t)
 
-;;; To override elmo-map-folder methods.
-(luna-define-method elmo-folder-list-unreads-internal
-  ((folder elmo-cache-folder) unread-marks &optional mark-alist)
-  t)
-
-(luna-define-method elmo-folder-unmark-important ((folder elmo-cache-folder)
-                                                 numbers)
-  t)
-
-(luna-define-method elmo-folder-mark-as-important ((folder elmo-cache-folder)
-                                                  numbers)
-  t)
-
-(luna-define-method elmo-folder-unmark-read ((folder elmo-cache-folder)
-                                            numbers)
-  t)
-
-(luna-define-method elmo-folder-mark-as-read ((folder elmo-cache-folder)
-                                             numbers)
-  t)
-
 (require 'product)
 (product-provide (provide 'elmo-cache) (require 'elmo-version))
 
index e08592a..e3a6d95 100644 (file)
@@ -66,7 +66,9 @@ Automatically loaded/saved.")
   '(elmo-folder-mark-as-read
     elmo-folder-unmark-read
     elmo-folder-mark-as-important
-    elmo-folder-unmark-important))
+    elmo-folder-unmark-important
+    elmo-folder-mark-as-answered
+    elmo-folder-unmark-answered))
 
 (defvar elmo-dop-queue-method-name-alist
   '((elmo-folder-append-buffer-dop-delayed . "Append")
@@ -75,6 +77,8 @@ Automatically loaded/saved.")
     (elmo-folder-create-dop-delayed . "Create")
     (elmo-folder-mark-as-read . "Read")
     (elmo-folder-unmark-read . "Unread")
+    (elmo-folder-mark-as-answered . "Answered")
+    (elmo-folder-unmark-answered . "Unanswered")    
     (elmo-folder-mark-as-important . "Important")
     (elmo-folder-unmark-important . "Unimportant")))
 
@@ -271,6 +275,12 @@ FOLDER is the folder structure."
 (defsubst elmo-folder-unmark-important-dop (folder numbers)
   (elmo-dop-queue-append folder 'elmo-folder-unmark-important (list numbers)))
 
+(defsubst elmo-folder-mark-as-answered-dop (folder numbers)
+  (elmo-dop-queue-append folder 'elmo-folder-mark-as-answered (list numbers)))
+
+(defsubst elmo-folder-unmark-answered-dop (folder numbers)
+  (elmo-dop-queue-append folder 'elmo-folder-unmark-answered (list numbers)))
+
 ;;; Execute as subsutitute for plugged operation.
 (defun elmo-folder-status-dop (folder)
   (let* ((number-alist (elmo-msgdb-number-load
@@ -280,8 +290,8 @@ FOLDER is the folder structure."
         spool-length
         (i 0)
         max-num)
-    (setq spool-length (car (if (elmo-folder-exists-p spool-folder)
-                               (elmo-folder-status spool-folder))))
+    (setq spool-length (or (car (if (elmo-folder-exists-p spool-folder)
+                                   (elmo-folder-status spool-folder))) 0))
     (setq max-num
          (or (nth (max (- (length number-list) 1) 0) number-list)
              0))
index 11b4cbd..4698329 100644 (file)
@@ -33,7 +33,7 @@
 ;;; ELMO filter folder
 (eval-and-compile
   (luna-define-class elmo-filter-folder (elmo-folder)
-                    (condition target))
+                    (condition target require-msgdb))
   (luna-define-internal-accessors 'elmo-filter-folder))
 
 (luna-define-method elmo-folder-initialize ((folder elmo-filter-folder)
         folder
         (elmo-make-folder (elmo-match-string 1 (cdr pair))))
       (error "Folder syntax error `%s'" (elmo-folder-name-internal folder)))
+    (elmo-filter-folder-set-require-msgdb-internal
+     folder
+     (elmo-folder-search-requires-msgdb-p
+      (elmo-filter-folder-target-internal folder)
+      (elmo-filter-folder-condition-internal folder)))
     folder))
 
 (luna-define-method elmo-folder-open-internal ((folder elmo-filter-folder))
   (elmo-folder-open-internal (elmo-filter-folder-target-internal folder)))
 
+(luna-define-method elmo-folder-msgdb :around ((folder elmo-filter-folder))
+  ;; Load target's msgdb if required.
+  (if (elmo-filter-folder-require-msgdb-internal folder)
+      (elmo-folder-msgdb (elmo-filter-folder-target-internal folder)))
+  ;; Load msgdb of itself.
+  (luna-call-next-method))
+
 (luna-define-method elmo-folder-check ((folder elmo-filter-folder))
-  (elmo-folder-check (elmo-filter-folder-target-internal folder)))
+  (elmo-folder-synchronize (elmo-filter-folder-target-internal folder)))
 
 (luna-define-method elmo-folder-close-internal ((folder elmo-filter-folder))
   (elmo-folder-close-internal (elmo-filter-folder-target-internal folder)))
 
+(luna-define-method elmo-folder-close :around ((folder elmo-filter-folder))
+  ;; Save target msgdb if it is used.
+  (if (elmo-filter-folder-require-msgdb-internal folder)
+      (elmo-folder-close (elmo-filter-folder-target-internal folder)))
+  (luna-call-next-method))
+
+(luna-define-method elmo-folder-commit :around ((folder elmo-filter-folder))
+  ;; Save target msgdb if it is used.
+  (if (elmo-filter-folder-require-msgdb-internal folder)
+      (elmo-folder-commit (elmo-filter-folder-target-internal folder)))
+  (luna-call-next-method))
+
 (luna-define-method elmo-folder-expand-msgdb-path ((folder
                                                    elmo-filter-folder))
   (expand-file-name
    type))
 
 (luna-define-method elmo-folder-msgdb-create ((folder elmo-filter-folder)
-                                             numlist new-mark already-mark
-                                             seen-mark important-mark
-                                             seen-list)
-  (let ((target-folder (elmo-filter-folder-target-internal folder)))
-    (if (elmo-folder-plugged-p target-folder)
-       (elmo-folder-msgdb-create target-folder
-                                 numlist
-                                 new-mark
-                                 already-mark
-                                 seen-mark important-mark seen-list)
-      ;; Copy from msgdb of target folder if it is unplugged.
-      (let ((len (length numlist))
-           (msgdb (elmo-folder-msgdb target-folder))
-           overview number-alist mark-alist
-           message-id seen gmark)
-       (when (> len elmo-display-progress-threshold)
-         (elmo-progress-set 'elmo-folder-msgdb-create
-                            len "Creating msgdb..."))
-       (unwind-protect
-           (dolist (number numlist)
-             (let ((entity (elmo-msgdb-overview-get-entity number msgdb)))
-               (when entity
-                 (setq entity (elmo-msgdb-copy-overview-entity entity)
-                       overview (elmo-msgdb-append-element overview entity)
-                       message-id (elmo-msgdb-overview-entity-get-id entity)
-                       number-alist (elmo-msgdb-number-add number-alist
-                                                           number
-                                                           message-id)
-                       seen (member message-id seen-list))
-                 (if (setq gmark (or (elmo-msgdb-global-mark-get message-id)
-                                     (if (elmo-file-cache-exists-p message-id)
-                                         (if seen
-                                             nil
-                                           already-mark)
-                                       (if seen
-                                           nil ;;seen-mark
-                                         new-mark))))
-                     (setq mark-alist
-                           (elmo-msgdb-mark-append
-                            mark-alist
-                            number
-                            gmark)))))
-             (elmo-progress-notify 'elmo-folder-msgdb-create))
-         (elmo-progress-clear 'elmo-folder-msgdb-create))
-       (list overview number-alist mark-alist)))))
+                                             numlist seen-list)
+  (let* ((target-folder (elmo-filter-folder-target-internal folder))
+        (len (length numlist))
+        (msgdb (elmo-folder-msgdb target-folder))
+        overview number-alist mark-alist message-id entity)
+    (when (> len elmo-display-progress-threshold)
+      (elmo-progress-set 'elmo-folder-msgdb-create
+                        len "Creating msgdb..."))
+    (unwind-protect
+       (dolist (number numlist)
+         (setq entity (elmo-msgdb-overview-get-entity number msgdb))
+         (when entity
+           (setq overview (elmo-msgdb-append-element overview entity)
+                 message-id (elmo-msgdb-overview-entity-get-id entity)
+                 number-alist (elmo-msgdb-number-add number-alist
+                                                     number
+                                                     message-id)
+                 mark-alist (elmo-msgdb-mark-append
+                             mark-alist
+                             number
+                             (elmo-msgdb-get-mark msgdb number))))
+         (elmo-progress-notify 'elmo-folder-msgdb-create))
+      (elmo-progress-clear 'elmo-folder-msgdb-create))
+    (list overview number-alist mark-alist)))
 
 (luna-define-method elmo-folder-append-buffer ((folder elmo-filter-folder)
                                               unread &optional number)
       ;; not available
       t)))
 
-(defsubst elmo-filter-folder-list-unreads-internal (folder unread-marks
-                                                          mark-alist)
-  (let ((unreads (elmo-folder-list-unreads-internal
-                 (elmo-filter-folder-target-internal folder)
-                 unread-marks
-                 (or mark-alist
-                     (elmo-msgdb-get-mark-alist
-                      (elmo-folder-msgdb folder))))))
-    (unless (listp unreads)
-      (setq unreads
-           (delq nil
-                 (mapcar
-                  (function
-                   (lambda (x)
-                     (if (member (cadr x) unread-marks)
-                         (car x))))
-                  (elmo-msgdb-get-mark-alist (elmo-folder-msgdb folder))))))
+(defsubst elmo-filter-folder-list-unreads (folder)
+  (elmo-list-filter
+   (elmo-folder-list-messages folder nil 'in-msgdb)
+   (elmo-folder-list-unreads
+    (elmo-filter-folder-target-internal folder))))
+
+(luna-define-method elmo-folder-list-unreads ((folder elmo-filter-folder))
+  (elmo-filter-folder-list-unreads folder))
+
+(defsubst elmo-filter-folder-list-importants (folder)
+  (elmo-uniq-list
+   (nconc
     (elmo-list-filter
-     (mapcar 'car (elmo-msgdb-get-number-alist
-                  (elmo-folder-msgdb folder)))
-     unreads)))
-
-(luna-define-method elmo-folder-list-unreads-internal
-  ((folder elmo-filter-folder)
-   unread-marks &optional mark-alist)
-  (elmo-filter-folder-list-unreads-internal folder unread-marks mark-alist))
-
-(defsubst elmo-filter-folder-list-importants-internal (folder important-mark)
-  (let ((importants (elmo-folder-list-importants-internal
-                    (elmo-filter-folder-target-internal folder)
-                    important-mark)))
-    (if (listp importants)
-       (elmo-list-filter
-        (mapcar 'car (elmo-msgdb-get-number-alist
-                      (elmo-folder-msgdb folder)))
-        importants)
-      t)))
+     (elmo-folder-list-messages folder nil 'in-msgdb)
+     (elmo-folder-list-importants
+      (elmo-filter-folder-target-internal folder)))
+    (elmo-folder-list-messages-with-global-mark
+     folder elmo-msgdb-important-mark))))
 
-(luna-define-method elmo-folder-list-importants-internal
-  ((folder elmo-filter-folder)
-   important-mark)
-  (elmo-filter-folder-list-importants-internal folder important-mark))
+(luna-define-method elmo-folder-list-importants ((folder elmo-filter-folder))
+  (elmo-filter-folder-list-importants folder))
 
 (luna-define-method elmo-folder-list-subfolders ((folder elmo-filter-folder)
                                                 &optional one-level)
   (elmo-message-file-name (elmo-filter-folder-target-internal folder)
                          number))
 
-(luna-define-method elmo-folder-mark-as-read ((folder elmo-filter-folder)
-                                             numbers)
+(luna-define-method elmo-folder-mark-as-read :around ((folder
+                                                      elmo-filter-folder)
+                                                     numbers)
   (elmo-folder-mark-as-read (elmo-filter-folder-target-internal folder)
-                           numbers))
+                           numbers)
+  (luna-call-next-method))
 
-(luna-define-method elmo-folder-unmark-read ((folder elmo-filter-folder)
-                                             numbers)
+(luna-define-method elmo-folder-unmark-read :around ((folder
+                                                     elmo-filter-folder)
+                                                    numbers)
   (elmo-folder-unmark-read (elmo-filter-folder-target-internal folder)
-                          numbers))
+                          numbers)
+  (luna-call-next-method))
 
-(luna-define-method elmo-folder-mark-as-important ((folder elmo-filter-folder)
-                                                  numbers)
+(luna-define-method elmo-folder-mark-as-important :around ((folder
+                                                           elmo-filter-folder)
+                                                          numbers)
   (elmo-folder-mark-as-important (elmo-filter-folder-target-internal folder)
-                                numbers))
+                                numbers)
+    (luna-call-next-method))
 
-(luna-define-method elmo-folder-unmark-important ((folder elmo-filter-folder)
-                                                 numbers)
-  (elmo-folder-unmark-important (elmo-filter-folder-target-internal folder)
-                               numbers))
 
+(luna-define-method elmo-folder-unmark-important :around ((folder
+                                                          elmo-filter-folder)
+                                                         numbers)
+  (elmo-folder-unmark-important (elmo-filter-folder-target-internal folder)
+                               numbers)
+  (luna-call-next-method))
+
+(luna-define-method elmo-folder-mark-as-answered :around ((folder
+                                                          elmo-filter-folder)
+                                                         numbers)
+  (elmo-folder-mark-as-answered (elmo-filter-folder-target-internal folder)
+                               numbers)
+  (luna-call-next-method))
+
+
+(luna-define-method elmo-folder-unmark-answered :around ((folder
+                                                         elmo-filter-folder)
+                                                        numbers)
+  (elmo-folder-unmark-answered (elmo-filter-folder-target-internal folder)
+                              numbers)
+  (luna-call-next-method))
 
 (require 'product)
 (product-provide (provide 'elmo-filter) (require 'elmo-version))
index edd2702..b4279f1 100644 (file)
@@ -792,18 +792,16 @@ If CHOP-LENGTH is not specified, message set is not chopped."
 
 ;;
 ;; app-data:
-;; cons of list
-;; 0: new-mark 1: already-mark 2: seen-mark 3: important-mark
-;; 4: seen-list
-;; and result of use-flag-p.
+;; cons of seen-list and result of use-flag-p.
 (defsubst elmo-imap4-fetch-callback-1-subr (entity flags app-data)
   "A msgdb entity callback function."
   (let* ((use-flag (cdr app-data))
         (app-data (car app-data))
-        (seen (member (car entity) (nth 4 app-data)))
+        (seen (member (car entity) app-data))
         mark)
     (if (member "\\Flagged" flags)
-       (elmo-msgdb-global-mark-set (car entity) (nth 3 app-data)))
+       (elmo-msgdb-global-mark-set (car entity)
+                                   elmo-msgdb-important-mark))
     (if (setq mark (elmo-msgdb-global-mark-get (car entity)))
        (unless (member "\\Seen" flags)
          (setq elmo-imap4-seen-messages
@@ -816,13 +814,13 @@ If CHOP-LENGTH is not specified, message set is not chopped."
                                 (and use-flag
                                      (member "\\Seen" flags)))
                             nil
-                          (nth 1 app-data))
+                          elmo-msgdb-unread-cached-mark)
                       (if (or seen
                               (and use-flag
                                    (member "\\Seen" flags)))
                           (if elmo-imap4-use-cache
-                              (nth 2 app-data))
-                        (nth 0 app-data))))))
+                              elmo-msgdb-read-uncached-mark)
+                        elmo-msgdb-new-mark)))))
     (setq elmo-imap4-current-msgdb
          (elmo-msgdb-append
           elmo-imap4-current-msgdb
@@ -1882,6 +1880,10 @@ Return nil if no complete line has arrived."
   ((folder elmo-imap4-folder))
   (elmo-imap4-list folder "flagged"))
 
+(luna-define-method elmo-folder-list-answereds-plugged
+  ((folder elmo-imap4-folder))
+  (elmo-imap4-list folder "answered"))
+
 (luna-define-method elmo-folder-use-flag-p ((folder elmo-imap4-folder))
   (not (string-match elmo-imap4-disuse-server-flag-mailbox-regexp
                     (elmo-imap4-folder-mailbox-internal folder))))
@@ -2095,7 +2097,7 @@ If optional argument REMOVE is non-nil, remove FLAG."
 (defun elmo-imap4-search-internal-primitive (folder session filter from-msgs)
   (let ((search-key (elmo-filter-key filter))
        (imap-search-keys '("bcc" "body" "cc" "from" "subject" "to"
-                           "larger" "smaller"))
+                           "larger" "smaller" "mark"))
        (total 0)
        (length (length from-msgs))
        charset set-list end results)
@@ -2113,6 +2115,14 @@ If optional argument REMOVE is non-nil, remove FLAG."
                           numbers)))
        (mapcar '(lambda (x) (delete x numbers)) rest)
        numbers))
+     ((string= "mark" search-key)
+      (cond
+       ((string= "unread" (elmo-filter-value filter))
+       (elmo-folder-list-unreads folder))
+       ((string= "important" (elmo-filter-value filter))
+       (elmo-folder-list-importants folder))
+       ((string= "answered" (elmo-filter-value filter))
+       (elmo-folder-list-answereds folder))))
      ((or (string= "since" search-key)
          (string= "before" search-key))
       (setq search-key (concat "sent" search-key)
@@ -2240,7 +2250,7 @@ If optional argument REMOVE is non-nil, remove FLAG."
     (luna-call-next-method)))
 
 (luna-define-method elmo-folder-msgdb-create-plugged
-  ((folder elmo-imap4-folder) numbers &rest args)
+  ((folder elmo-imap4-folder) numbers seen-list)
   (when numbers
     (let ((session (elmo-imap4-get-session folder))
          (headers
@@ -2265,7 +2275,7 @@ If optional argument REMOVE is non-nil, remove FLAG."
        (setq elmo-imap4-current-msgdb nil
              elmo-imap4-seen-messages nil
              elmo-imap4-fetch-callback 'elmo-imap4-fetch-callback-1
-             elmo-imap4-fetch-callback-data (cons args
+             elmo-imap4-fetch-callback-data (cons seen-list
                                                   (elmo-folder-use-flag-p
                                                    folder)))
        (while set-list
@@ -2305,6 +2315,14 @@ If optional argument REMOVE is non-nil, remove FLAG."
   ((folder elmo-imap4-folder) numbers)
   (elmo-imap4-set-flag folder numbers "\\Seen"))
 
+(luna-define-method elmo-folder-unmark-answered-plugged
+  ((folder elmo-imap4-folder) numbers)
+  (elmo-imap4-set-flag folder numbers "\\Answered" 'remove))
+
+(luna-define-method elmo-folder-mark-as-answered-plugged
+  ((folder elmo-imap4-folder) numbers)
+  (elmo-imap4-set-flag folder numbers "\\Answered"))
+
 (luna-define-method elmo-message-use-cache-p ((folder elmo-imap4-folder)
                                              number)
   elmo-imap4-use-cache)
@@ -2513,8 +2531,7 @@ If optional argument REMOVE is non-nil, remove FLAG."
                     (elmo-net-folder-user-internal (, folder2)))))))
 
 (luna-define-method elmo-folder-append-messages :around
-  ((folder elmo-imap4-folder) src-folder numbers unread-marks
-   &optional same-number)
+  ((folder elmo-imap4-folder) src-folder numbers &optional same-number)
   (if (and (eq (elmo-folder-type-internal src-folder) 'imap4)
           (elmo-imap4-identical-system-p folder src-folder)
           (elmo-folder-plugged-p folder))
@@ -2605,7 +2622,10 @@ If optional argument REMOVE is non-nil, remove FLAG."
       (goto-char (point-min))
       (std11-field-body (symbol-name field)))))
 
-
+(luna-define-method elmo-folder-search-requires-msgdb-p ((folder
+                                                         elmo-imap4-folder)
+                                                        condition)
+  nil)
 
 (require 'product)
 (product-provide (provide 'elmo-imap4) (require 'elmo-version))