* wl-mime.el (wl-message-delete-current-part): Check the class of mime-entity.
[elisp/wanderlust.git] / elmo / elmo.el
index 34279bc..42f5448 100644 (file)
@@ -256,13 +256,9 @@ If second optional IN-MSGDB is non-nil, only messages in the msgdb are listed."
     msgs))
 
 (luna-define-method elmo-folder-list-importants ((folder elmo-folder))
-  (elmo-uniq-list
-   (nconc
-    (elmo-folder-list-messages-with-global-mark folder
-                                               elmo-msgdb-important-mark)
-    (elmo-folder-list-messages-mark-match folder
-                                         (regexp-quote
-                                          elmo-msgdb-important-mark)))))
+  (elmo-folder-list-messages-mark-match folder
+                                       (regexp-quote
+                                        elmo-msgdb-important-mark)))
 
 (luna-define-method elmo-folder-list-answereds ((folder elmo-folder))
   (delq nil
@@ -332,11 +328,11 @@ CONDITION is a condition structure for testing.
 NUMBERS is a list of message numbers,
 use to be test for \"last\" and \"first\" predicates.")
 
-(luna-define-generic elmo-folder-msgdb-create (folder numbers seen-list)
+(luna-define-generic elmo-folder-msgdb-create (folder numbers id-mark-table)
   "Create a message database (implemented in each backends).
 FOLDER is the ELMO folder structure.
 NUMBERS is a list of message numbers to create msgdb.
-SEEN-LIST is a list of message-id string which should be treated as read.")
+ID-MARK-TABLE is a hashtable of message-id and its status mark.")
 
 (luna-define-generic elmo-folder-unmark-important (folder numbers)
   "Un-mark messages as important.
@@ -348,15 +344,19 @@ NUMBERS is a list of message numbers to be processed.")
 FOLDER is the ELMO folder structure.
 NUMBERS is a list of message numbers to be processed.")
 
-(luna-define-generic elmo-folder-unmark-read (folder numbers)
+(luna-define-generic elmo-folder-unmark-read (folder numbers
+                                                    &optional ignore-flags)
   "Un-mark messages as read.
 FOLDER is the ELMO folder structure.
-NUMBERS is a list of message numbers to be processed.")
+NUMBERS is a list of message numbers to be processed.
+If IGNORE-FLAGS is non-nil, folder flags are not updated.")
 
-(luna-define-generic elmo-folder-mark-as-read (folder numbers)
+(luna-define-generic elmo-folder-mark-as-read (folder numbers
+                                                     &optional ignore-flags)
   "Mark messages as read.
 FOLDER is the ELMO folder structure.
-NUMBERS is a list of message numbers to be processed.")
+NUMBERS is a list of message numbers to be processed.
+If IGNORE-FLAGS is non-nil, folder flags are not updated.")
 
 (luna-define-generic elmo-folder-unmark-answered (folder numbers)
   "Un-mark messages as answered.
@@ -771,14 +771,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
@@ -954,14 +952,11 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).")
                                  0))
              (elmo-folder-set-info-hashtb folder in-db-max nil))
          (setq in-db-max cached-in-db-max)))
-      (setq unsync (if (and in-db
-                           (car in-folder))
+      (setq unsync (if (and in-db (car in-folder))
                       (- (car in-folder) in-db-max)
-                    (if (and in-folder
-                             (null in-db))
+                    (if (and in-folder (null in-db))
                         (cdr in-folder)
-                      (if (null (car in-folder))
-                          nil))))
+                      (car in-folder))))
       (setq messages (cdr in-folder))
       (if (and unsync messages (> unsync messages))
          (setq unsync messages))
@@ -1114,6 +1109,16 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).")
        folder
        (elmo-folder-expand-msgdb-path folder))))
 
+(defun elmo-message-set-cached (folder number cached)
+  "Set cache status of the message mark.
+FOLDER is the ELMO folder structure.
+NUMBER is a number of the message.
+If CACHED is t, message mark is set as cached."
+  (when (elmo-msgdb-set-cached
+        (elmo-folder-msgdb folder) number cached)
+    (elmo-folder-set-mark-modified-internal folder t)))
+
+
 (defun elmo-message-mark (folder number)
   "Get mark of the message.
 FOLDER is the ELMO folder structure.
@@ -1153,52 +1158,56 @@ FIELD is a symbol of the field."
                                                  numbers)
   (when (elmo-folder-msgdb-internal folder)
     (dolist (number numbers)
-      (elmo-msgdb-unset-status (elmo-folder-msgdb folder)
-                              folder
-                              number
-                              'important))))
-
-(luna-define-method elmo-folder-mark-as-important ((folder elmo-folder)
-                                                  numbers)
-  (when (elmo-folder-msgdb-internal folder)
-    (dolist (number numbers)
-      (elmo-msgdb-set-status (elmo-folder-msgdb folder)
+      (elmo-msgdb-unset-flag (elmo-folder-msgdb folder)
                             folder
                             number
                             'important))))
 
-(luna-define-method elmo-folder-unmark-read ((folder elmo-folder) numbers)
+(luna-define-method elmo-folder-mark-as-important ((folder elmo-folder)
+                                                  numbers)
   (when (elmo-folder-msgdb-internal folder)
     (dolist (number numbers)
-      (elmo-msgdb-unset-status (elmo-folder-msgdb folder)
-                              folder
-                              number
-                              'read))))
-
-(luna-define-method elmo-folder-mark-as-read ((folder elmo-folder) numbers)
+      (elmo-msgdb-set-flag (elmo-folder-msgdb folder)
+                          folder
+                          number
+                          'important))))
+
+(luna-define-method elmo-folder-unmark-read ((folder elmo-folder)
+                                            numbers
+                                            &optional ignore-flags)
   (when (elmo-folder-msgdb-internal folder)
     (dolist (number numbers)
-      (elmo-msgdb-set-status (elmo-folder-msgdb folder)
+      (elmo-msgdb-unset-flag (elmo-folder-msgdb folder)
                             folder
                             number
                             'read))))
 
-(luna-define-method elmo-folder-unmark-answered ((folder elmo-folder) numbers)
+(luna-define-method elmo-folder-mark-as-read ((folder elmo-folder)
+                                             numbers
+                                             &optional ignore-flag)
   (when (elmo-folder-msgdb-internal folder)
     (dolist (number numbers)
-      (elmo-msgdb-unset-status (elmo-folder-msgdb folder)
-                              folder
-                              number
-                              'answered))))
+      (elmo-msgdb-set-flag (elmo-folder-msgdb folder)
+                          folder
+                          number
+                          'read))))
 
-(luna-define-method elmo-folder-mark-as-answered ((folder elmo-folder) numbers)
+(luna-define-method elmo-folder-unmark-answered ((folder elmo-folder) numbers)
   (when (elmo-folder-msgdb-internal folder)
     (dolist (number numbers)
-      (elmo-msgdb-set-status (elmo-folder-msgdb folder)
+      (elmo-msgdb-unset-flag (elmo-folder-msgdb folder)
                             folder
                             number
                             'answered))))
 
+(luna-define-method elmo-folder-mark-as-answered ((folder elmo-folder) numbers)
+  (when (elmo-folder-msgdb-internal folder)
+    (dolist (number numbers)
+      (elmo-msgdb-set-flag (elmo-folder-msgdb folder)
+                          folder
+                          number
+                          'answered))))
+
 (luna-define-method elmo-folder-process-crosspost ((folder elmo-folder)
                                                   &optional
                                                   number-alist)
@@ -1342,7 +1351,7 @@ FIELD is a symbol of the field."
   "Synchronize the folder data to the newest status.
 FOLDER is the ELMO folder structure.
 If optional IGNORE-MSGDB is non-nil, current msgdb is thrown away except
-read mark status. If IGNORE-MSGDB is 'visible-only, only visible messages
+flag status. If IGNORE-MSGDB is 'visible-only, only visible messages
 \(the messages which are not in the killed-list\) are thrown away and
 synchronized.
 If NO-CHECK is non-nil, rechecking folder is skipped.
@@ -1591,6 +1600,7 @@ Return a hashtable for newsgroups."
 
 ;; autoloads
 (autoload 'elmo-dop-queue-flush "elmo-dop")
+(autoload 'elmo-nntp-post "elmo-nntp")
 
 (require 'product)
 (product-provide (provide 'elmo) (require 'elmo-version))