* wl-vars.el: Changed file coding system to ISO-2022-JP.
[elisp/wanderlust.git] / elmo / elmo2.el
index cb21136..b018394 100644 (file)
     (elmo-dop-max-of-folder folder)))
 
 ;;  list elmo-list-folder (folder)
-(defun elmo-list-folder (folder)
+(defun elmo-list-folder (folder &optional nohide)
   (if (elmo-folder-plugged-p folder)
-      (elmo-call-func folder "list-folder")
-    (elmo-dop-list-folder folder)))
+      (elmo-call-func folder "list-folder" nohide)
+    (elmo-dop-list-folder folder nohide)))
 
 ;;  list elmo-list-folders (folder)
 (defun elmo-list-folders (folder &optional hierarchy)
           (elmo-msgdb-rename-path old-folder new-folder))
        (elmo-dop-rename-folder old-folder new-folder)))))
 
-(defun elmo-read-msg-no-cache (folder msg outbuf)
+(defun elmo-read-msg-no-cache (folder msg outbuf &optional unread)
   "Read messsage specified by FOLDER and MSG(number) into OUTBUF
-without cacheing."
-  (elmo-call-func folder "read-msg" msg outbuf))
+without cacheing.
+If optional UNREAD is non-nil, message is keeped as unread."
+  (elmo-call-func folder "read-msg" msg outbuf nil unread))
 
 (defun elmo-force-cache-msg (folder number msgid &optional loc-alist)
   "Force cache message."
@@ -180,7 +181,9 @@ without cacheing."
              ((elmo-folder-local-p (car real-fld-num)))
              (t (setq ret-val (elmo-call-func (car real-fld-num)
                                               "read-msg"
-                                              (cdr real-fld-num) outbuf))))
+                                              (cdr real-fld-num)
+                                              outbuf
+                                              nil 'unread))))
        (if ret-val
            (elmo-cache-save message-id
                             (elmo-string-partial-p ret-val)
@@ -205,17 +208,18 @@ without cacheing."
 
 ;;  elmo-read-msg (folder msg outbuf msgdb)
 ;;; read message
-(defun elmo-read-msg (folder msg outbuf msgdb &optional force-reload)
+(defun elmo-read-msg (folder msg outbuf msgdb &optional force-reload unread)
   "Read message into outbuf."
   (let ((inhibit-read-only t))
+    (if elmo-inhibit-read-cache
     ;;Only use elmo-read-msg-with-cache, because if folder is network and
     ;;elmo-use-cache-p is nil, cannot read important msg. (by muse)
     ;;(if (not (elmo-use-cache-p folder msg))
-    ;;  (elmo-read-msg-no-cache folder msg outbuf)
-    (elmo-read-msg-with-cache folder msg outbuf msgdb force-reload)))
+       (elmo-read-msg-no-cache folder msg outbuf unread)
+      (elmo-read-msg-with-cache folder msg outbuf msgdb force-reload unread))))
 
 (defun elmo-read-msg-with-cache (folder msg outbuf msgdb
-                                       &optional force-reload)
+                                       &optional force-reload unread)
   "Read message into outbuf with cacheing."
   (let* ((number-alist (elmo-msgdb-get-number-alist
                        (or msgdb (elmo-msgdb-load folder))))
@@ -235,7 +239,8 @@ without cacheing."
                          folder msg))
       (if (setq ret-val (elmo-call-func (car real-fld-num)
                                        "read-msg"
-                                       (cdr real-fld-num) outbuf))
+                                       (cdr real-fld-num) outbuf
+                                       nil unread))
          (if (and message-id
                   (not (elmo-local-file-p folder msg))
                   (elmo-use-cache-p folder msg))
@@ -268,6 +273,7 @@ without cacheing."
           (number-alist (elmo-msgdb-get-number-alist db))
           (mark-alist   (elmo-msgdb-get-mark-alist db))
           (messages msgs)
+          (elmo-inhibit-display-retrieval-progress t)
           (len (length msgs))
           (all-msg-num (or all len))
           (done-msg-num (or done 0))
@@ -729,7 +735,7 @@ message list in msgdb. Otherwise, number-list is load from msgdb."
       (setq mark-alist (cdr mark-alist)))
     (nreverse ret-val)))
 
-(defun elmo-buffer-cache-message (fld msg &optional msgdb force-reload)
+(defun elmo-buffer-cache-message (fld msg &optional msgdb force-reload unread)
   (let* ((msg-id (cdr (assq msg (elmo-msgdb-get-number-alist msgdb))))
         (hit (elmo-buffer-cache-hit (list fld msg msg-id)))
         (read nil))
@@ -744,7 +750,8 @@ message list in msgdb. Otherwise, number-list is load from msgdb."
              (set-buffer hit)
              (elmo-read-msg fld msg
                             (current-buffer)
-                            msgdb force-reload))
+                            msgdb force-reload
+                            unread))
          (quit
           (elmo-buffer-cache-delete)
           (error "read message %s/%s is quitted" fld msg))
@@ -915,6 +922,16 @@ message list in msgdb. Otherwise, number-list is load from msgdb."
         (fld (nth (- (/ number elmo-multi-divide-number) 1) flds)))
     (elmo-folder-number-get-spec fld number)))
 
+(defun elmo-msgdb-list-messages-mark-match (msgdb mark-regexp)
+  "List messages in the FOLDER which have a mark that matches MARK-REGEXP"
+  (let ((case-fold-search nil)
+       matched)
+    (if mark-regexp
+       (dolist (elem (elmo-msgdb-get-mark-alist msgdb))
+         (if (string-match mark-regexp (cadr elem))
+             (setq matched (cons (car elem) matched)))))
+    matched))
+
 ;; autoloads
 (autoload 'elmo-nntp-make-groups-hashtb "elmo-nntp")
 (autoload 'elmo-nntp-post "elmo-nntp")